Skip to content

Commit b2aeb07

Browse files
committed
Use trimmed instead of line for performance
1 parent 3a20d52 commit b2aeb07

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tools/tidy/src/style.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,14 @@ pub fn check(path: &Path, bad: &mut bool) {
431431
}
432432

433433
if filename.ends_with(".ftl") {
434-
let line_backticks = line.chars().filter(|ch| *ch == '`').count();
434+
let line_backticks = trimmed.chars().filter(|ch| *ch == '`').count();
435435
if line_backticks % 2 == 1 {
436436
suppressible_tidy_err!(err, skip_odd_backticks, "odd number of backticks");
437437
}
438-
} else if line.contains("//") {
438+
} else if trimmed.contains("//") {
439439
let (start_line, mut backtick_count) = comment_block.unwrap_or((i + 1, 0));
440-
let line_backticks = line.chars().filter(|ch| *ch == '`').count();
441-
let comment_text = line.split("//").nth(1).unwrap();
440+
let line_backticks = trimmed.chars().filter(|ch| *ch == '`').count();
441+
let comment_text = trimmed.split("//").nth(1).unwrap();
442442
// This check ensures that we don't lint for code that has `//` in a string literal
443443
if line_backticks % 2 == 1 {
444444
backtick_count += comment_text.chars().filter(|ch| *ch == '`').count();

0 commit comments

Comments
 (0)