@@ -44,7 +44,6 @@ use crate::renderer::source_map::{AnnotatedLineInfo, Loc, SourceMap};
4444use crate :: renderer:: styled_buffer:: StyledBuffer ;
4545use crate :: { Annotation , AnnotationKind , Element , Group , Level , Message , Origin , Snippet , Title } ;
4646pub use anstyle:: * ;
47- use indexmap:: IndexMap ;
4847use margin:: Margin ;
4948use std:: borrow:: Cow ;
5049use std:: cmp:: { max, min, Ordering , Reverse } ;
@@ -638,7 +637,7 @@ impl Renderer {
638637 self . draw_col_separator_no_space ( buffer, buffer_msg_line_offset, max_line_num_len + 1 ) ;
639638
640639 // Contains the vertical lines' positions for active multiline annotations
641- let mut multilines = IndexMap :: new ( ) ;
640+ let mut multilines = Vec :: new ( ) ;
642641
643642 // Get the left-side margin to remove it
644643 let mut whitespace_margin = usize:: MAX ;
@@ -728,8 +727,9 @@ impl Renderer {
728727 let mut to_add = HashMap :: new ( ) ;
729728
730729 for ( depth, style) in depths {
731- // FIXME(#120456) - is `swap_remove` correct?
732- if multilines. swap_remove ( & depth) . is_none ( ) {
730+ if let Some ( index) = multilines. iter ( ) . position ( |( d, _) | d == & depth) {
731+ multilines. swap_remove ( index) ;
732+ } else {
733733 to_add. insert ( depth, style) ;
734734 }
735735 }
@@ -834,7 +834,7 @@ impl Renderer {
834834 }
835835 }
836836
837- multilines. extend ( & to_add) ;
837+ multilines. extend ( to_add) ;
838838 }
839839 }
840840
0 commit comments