diff --git a/src/missed_spans.rs b/src/missed_spans.rs index 98d87ba4963c..b49686d40a68 100644 --- a/src/missed_spans.rs +++ b/src/missed_spans.rs @@ -178,6 +178,13 @@ impl<'a> FmtVisitor<'a> { if last_wspace.is_none() { last_wspace = Some(i); } + } else if c == ';' { + if last_wspace.is_some() { + line_start = i; + } + + rewrite_next_comment = rewrite_next_comment || kind == CodeCharKind::Normal; + last_wspace = None; } else { rewrite_next_comment = rewrite_next_comment || kind == CodeCharKind::Normal; last_wspace = None; diff --git a/tests/source/issue-1192.rs b/tests/source/issue-1192.rs new file mode 100644 index 000000000000..4e39fbf9a366 --- /dev/null +++ b/tests/source/issue-1192.rs @@ -0,0 +1,3 @@ +fn main() { + assert!(true) ; +} diff --git a/tests/target/issue-1192.rs b/tests/target/issue-1192.rs new file mode 100644 index 000000000000..432fe8cce7c8 --- /dev/null +++ b/tests/target/issue-1192.rs @@ -0,0 +1,3 @@ +fn main() { + assert!(true); +}