Skip to content

Commit 0c8bb37

Browse files
committed
fix: Remove unneeded annotation sorting
1 parent 7a77fce commit 0c8bb37

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/renderer/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,7 @@ impl Renderer {
695695
if let Some(first_annotation) = primary_line
696696
.annotations
697697
.iter()
698-
.find(|a| a.is_primary())
699-
.or(primary_line.annotations.first())
698+
.min_by_key(|a| (Reverse(a.is_primary()), a.start.char))
700699
{
701700
origin.char_column = Some(first_annotation.start.char + 1);
702701
}

src/renderer/source_map.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,6 @@ impl<'a> SourceMap<'a> {
293293
annotated_line_infos.retain(|l| !l.annotations.is_empty());
294294
}
295295

296-
for l in annotated_line_infos.iter_mut() {
297-
l.annotations.sort_by(|a, b| a.start.cmp(&b.start));
298-
}
299-
300296
(max_depth, annotated_line_infos)
301297
}
302298

tests/rustc_tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,7 +2605,7 @@ error[E0532]: expected unit struct, unit variant or constant, found tuple varian
26052605
LL | E1::Z1 => {} //~ ERROR expected unit struct, unit variant or constant, found tuple variant `E1::Z1`
26062606
| ^^^^^^
26072607
|
2608-
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:15
2608+
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:19
26092609
|
26102610
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
26112611
| -- -- `E1::Z1` defined here
@@ -2669,7 +2669,9 @@ LL | /* //~ ERROR E0758
26692669
| |
26702670
LL | | /* */
26712671
LL | | /*
2672-
| | -- ...as last nested comment starts here, maybe you want to close this instead?
2672+
| | --
2673+
| | |
2674+
| | ...as last nested comment starts here, maybe you want to close this instead?
26732675
LL | | */
26742676
| |_--^
26752677
| |

0 commit comments

Comments
 (0)