diff --git a/src/utils.rs b/src/utils.rs index 1be83d01baba..dc5dee6ba0d9 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -111,9 +111,10 @@ pub fn trimmed_last_line_width(s: &str) -> usize { #[inline] pub fn last_line_extendable(s: &str) -> bool { s.lines().last().map_or(false, |s| { - s.trim() - .chars() - .all(|c| c == ')' || c == ']' || c == '}' || c == '?') + s.ends_with("\"#") || + s.trim() + .chars() + .all(|c| c == ')' || c == ']' || c == '}' || c == '?') }) } diff --git a/tests/source/chains.rs b/tests/source/chains.rs index 20d320ccde89..99fe6176aa84 100644 --- a/tests/source/chains.rs +++ b/tests/source/chains.rs @@ -152,3 +152,14 @@ fn issue_1004() { }) ?; } + +fn issue1392() { + test_method(r#" + if foo { + a(); + } + else { + b(); + } + "#.trim()); +} diff --git a/tests/target/chains.rs b/tests/target/chains.rs index 52e65b420e71..d930f0a49bad 100644 --- a/tests/target/chains.rs +++ b/tests/target/chains.rs @@ -169,3 +169,16 @@ fn issue_1004() { in_binder(f, tcx, &ty::Binder(""), Some(tap)) })?; } + +fn issue1392() { + test_method( + r#" + if foo { + a(); + } + else { + b(); + } + "#.trim(), + ); +}