Skip to content

Commit 0ae1a69

Browse files
author
Michael Wright
committed
Fix too_many_lines false positive
Fixes #4364
1 parent 1f99937 commit 0ae1a69

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

clippy_lints/src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl<'a, 'tcx> Functions {
200200
Some(i) => i + 1,
201201
None => 0,
202202
};
203-
let end_brace_idx = match code_snippet.find('}') {
203+
let end_brace_idx = match code_snippet.rfind('}') {
204204
Some(i) => i,
205205
None => code_snippet.len(),
206206
};

tests/ui/functions_maxlines.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ fn good_lines() {
5656
}
5757

5858
fn bad_lines() {
59+
println!("Dont get confused by braces: {{}}");
5960
println!("This is bad.");
6061
println!("This is bad.");
6162
println!("This is bad.");

tests/ui/functions_maxlines.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: This function has a large number of lines.
22
--> $DIR/functions_maxlines.rs:58:1
33
|
44
LL | / fn bad_lines() {
5-
LL | | println!("This is bad.");
5+
LL | | println!("Dont get confused by braces: {{}}");
66
LL | | println!("This is bad.");
77
LL | | println!("This is bad.");
88
... |

0 commit comments

Comments
 (0)