diff options
| author | AnthonyMikh <anthony.mikh@yandex.ru> | 2019-10-25 19:21:31 +0300 |
|---|---|---|
| committer | AnthonyMikh <anthony.mikh@yandex.ru> | 2019-10-27 12:02:34 +0300 |
| commit | 159d8a4154e9923e4890ce32d98e3ce5f43eafea (patch) | |
| tree | 6450f48833b57b185b7e9e2e3c5bbaaf31a31536 /src/librustc_errors | |
| parent | 23f890f10202a71168c6424da0cdf94135d3c40c (diff) | |
| download | rust-159d8a4154e9923e4890ce32d98e3ce5f43eafea.tar.gz rust-159d8a4154e9923e4890ce32d98e3ce5f43eafea.zip | |
Remove a loop which runs exactly once
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index e3b55a14133..6463697e22f 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1817,10 +1817,9 @@ impl FileWithAnnotatedLines { // Every `|` that joins the beginning of the span (`___^`) to the end (`|__^`). add_annotation_to_file(&mut output, file.clone(), line, ann.as_line()); } - if middle < ann.line_end - 1 { - for line in ann.line_end - 1..ann.line_end { - add_annotation_to_file(&mut output, file.clone(), line, ann.as_line()); - } + let line_end = ann.line_end - 1; + if middle < line_end { + add_annotation_to_file(&mut output, file.clone(), line_end, ann.as_line()); } } else { end_ann.annotation_type = AnnotationType::Singleline; |
