Allow extending a chain after raw string literal

This commit is contained in:
Seiichi Uchida 2017-06-19 22:06:08 +09:00
parent a87a4450aa
commit b99f3cb447
3 changed files with 28 additions and 3 deletions

View File

@ -111,9 +111,10 @@ pub fn trimmed_last_line_width(s: &str) -> usize {
#[inline] #[inline]
pub fn last_line_extendable(s: &str) -> bool { pub fn last_line_extendable(s: &str) -> bool {
s.lines().last().map_or(false, |s| { s.lines().last().map_or(false, |s| {
s.trim() s.ends_with("\"#") ||
.chars() s.trim()
.all(|c| c == ')' || c == ']' || c == '}' || c == '?') .chars()
.all(|c| c == ')' || c == ']' || c == '}' || c == '?')
}) })
} }

View File

@ -152,3 +152,14 @@ fn issue_1004() {
}) })
?; ?;
} }
fn issue1392() {
test_method(r#"
if foo {
a();
}
else {
b();
}
"#.trim());
}

View File

@ -169,3 +169,16 @@ fn issue_1004() {
in_binder(f, tcx, &ty::Binder(""), Some(tap)) in_binder(f, tcx, &ty::Binder(""), Some(tap))
})?; })?;
} }
fn issue1392() {
test_method(
r#"
if foo {
a();
}
else {
b();
}
"#.trim(),
);
}