Fix too_many_lines false positive

Fixes #4364
This commit is contained in:
Michael Wright 2019-09-03 06:25:54 +02:00
parent 1f9993729b
commit 0ae1a69330
3 changed files with 3 additions and 2 deletions

View file

@ -200,7 +200,7 @@ impl<'a, 'tcx> Functions {
Some(i) => i + 1,
None => 0,
};
let end_brace_idx = match code_snippet.find('}') {
let end_brace_idx = match code_snippet.rfind('}') {
Some(i) => i,
None => code_snippet.len(),
};

View file

@ -56,6 +56,7 @@ fn good_lines() {
}
fn bad_lines() {
println!("Dont get confused by braces: {{}}");
println!("This is bad.");
println!("This is bad.");
println!("This is bad.");

View file

@ -2,7 +2,7 @@ error: This function has a large number of lines.
--> $DIR/functions_maxlines.rs:58:1
|
LL | / fn bad_lines() {
LL | | println!("This is bad.");
LL | | println!("Dont get confused by braces: {{}}");
LL | | println!("This is bad.");
LL | | println!("This is bad.");
... |