Skip to content

Commit 8b07292

Browse files
committed
Auto merge of #65827 - AnthonyMikh:out_of_the_loop, r=estebank
Remove a loop which runs exactly once Though the code seems to work properly, it is worth removing the loop entirely in order to not confuse the reader. r? @estebank
2 parents aa51f04 + 159d8a4 commit 8b07292

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/librustc_errors/emitter.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1816,10 +1816,9 @@ impl FileWithAnnotatedLines {
18161816
// Every `|` that joins the beginning of the span (`___^`) to the end (`|__^`).
18171817
add_annotation_to_file(&mut output, file.clone(), line, ann.as_line());
18181818
}
1819-
if middle < ann.line_end - 1 {
1820-
for line in ann.line_end - 1..ann.line_end {
1821-
add_annotation_to_file(&mut output, file.clone(), line, ann.as_line());
1822-
}
1819+
let line_end = ann.line_end - 1;
1820+
if middle < line_end {
1821+
add_annotation_to_file(&mut output, file.clone(), line_end, ann.as_line());
18231822
}
18241823
} else {
18251824
end_ann.annotation_type = AnnotationType::Singleline;

0 commit comments

Comments
 (0)