@@ -278,7 +278,8 @@ impl<'a, T: Source> StreamChunks<'a> for ReplaceSource<T> {
278
278
RefCell :: new ( Vec :: new ( ) ) ;
279
279
let name_mapping: RefCell < HashMap < Cow < str > , u32 > > =
280
280
RefCell :: new ( HashMap :: default ( ) ) ;
281
- let name_index_mapping: RefCell < Vec < u32 > > = RefCell :: new ( Vec :: new ( ) ) ;
281
+ let name_index_mapping: RefCell < HashMap < u32 , u32 > > =
282
+ RefCell :: new ( HashMap :: default ( ) ) ;
282
283
283
284
// check if source_content[line][col] is equal to expect
284
285
// Why this is needed?
@@ -404,10 +405,7 @@ impl<'a, T: Source> StreamChunks<'a> for ReplaceSource<T> {
404
405
original_line : original. original_line ,
405
406
original_column : original. original_column ,
406
407
name_index : original. name_index . and_then ( |name_index| {
407
- name_index_mapping
408
- . borrow ( )
409
- . get ( name_index as usize )
410
- . copied ( )
408
+ name_index_mapping. borrow ( ) . get ( & name_index) . copied ( )
411
409
} ) ,
412
410
}
413
411
} ) ,
@@ -582,10 +580,7 @@ impl<'a, T: Source> StreamChunks<'a> for ReplaceSource<T> {
582
580
original_line : original. original_line ,
583
581
original_column : original. original_column ,
584
582
name_index : original. name_index . and_then ( |name_index| {
585
- name_index_mapping
586
- . borrow ( )
587
- . get ( name_index as usize )
588
- . copied ( )
583
+ name_index_mapping. borrow ( ) . get ( & name_index) . copied ( )
589
584
} ) ,
590
585
}
591
586
} ) ,
@@ -614,7 +609,7 @@ impl<'a, T: Source> StreamChunks<'a> for ReplaceSource<T> {
614
609
}
615
610
name_index_mapping
616
611
. borrow_mut ( )
617
- . insert ( name_index as usize , global_index. unwrap ( ) ) ;
612
+ . insert ( name_index, global_index. unwrap ( ) ) ;
618
613
} ,
619
614
) ;
620
615
0 commit comments