From 4a82252f034ccb4ad886de2466cb093203ecc994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 30 Oct 2018 03:11:14 +0100 Subject: [PATCH] missed-spans: Fix bogus check. I don't really know what it's trying to do, but forgetting about everything you've seen before when you see whitespace followed by a semicolon doesn't look right to me, and absolutely no tests were hitting that. This check was introduced in 5ecdd072d6745cd70ec7c37eea8dbf1f3ee42f2e, however it was wrong even at that point, and now rustfmt still passes that test, regardless of macro name. Fixes #3154. --- src/missed_spans.rs | 3 --- tests/source/long-use-statement-issue-3154.rs | 3 +++ tests/target/long-use-statement-issue-3154.rs | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 tests/source/long-use-statement-issue-3154.rs create mode 100644 tests/target/long-use-statement-issue-3154.rs diff --git a/src/missed_spans.rs b/src/missed_spans.rs index 2b48673dcd4..28cd9874d9c 100644 --- a/src/missed_spans.rs +++ b/src/missed_spans.rs @@ -308,9 +308,6 @@ fn process_missing_code( status.line_start = i + 1; } else if c.is_whitespace() && status.last_wspace.is_none() { status.last_wspace = Some(i); - } else if c == ';' && status.last_wspace.is_some() { - status.line_start = i; - status.last_wspace = None; } else { status.last_wspace = None; } diff --git a/tests/source/long-use-statement-issue-3154.rs b/tests/source/long-use-statement-issue-3154.rs new file mode 100644 index 00000000000..339382b5bbf --- /dev/null +++ b/tests/source/long-use-statement-issue-3154.rs @@ -0,0 +1,3 @@ +// rustfmt-reorder_imports: false + +pub use self :: super :: super :: super :: root::mozilla::detail::StringClassFlags as nsTStringRepr_ClassFlags ; diff --git a/tests/target/long-use-statement-issue-3154.rs b/tests/target/long-use-statement-issue-3154.rs new file mode 100644 index 00000000000..339382b5bbf --- /dev/null +++ b/tests/target/long-use-statement-issue-3154.rs @@ -0,0 +1,3 @@ +// rustfmt-reorder_imports: false + +pub use self :: super :: super :: super :: root::mozilla::detail::StringClassFlags as nsTStringRepr_ClassFlags ;