@@ -8,7 +8,7 @@ use clippy_utils::visitors::for_each_expr_without_closures;
88use clippy_utils:: { eq_expr_value, hash_expr, higher} ;
99use rustc_ast:: { LitKind , RangeLimits } ;
1010use rustc_data_structures:: packed:: Pu128 ;
11- use rustc_data_structures:: unhash:: UnhashMap ;
11+ use rustc_data_structures:: unhash:: UnindexMap ;
1212use rustc_errors:: { Applicability , Diag } ;
1313use rustc_hir:: { BinOp , Block , Body , Expr , ExprKind , UnOp } ;
1414use rustc_lint:: { LateContext , LateLintPass } ;
@@ -226,7 +226,7 @@ fn upper_index_expr(expr: &Expr<'_>) -> Option<usize> {
226226}
227227
228228/// Checks if the expression is an index into a slice and adds it to `indexes`
229- fn check_index < ' hir > ( cx : & LateContext < ' _ > , expr : & ' hir Expr < ' hir > , map : & mut UnhashMap < u64 , Vec < IndexEntry < ' hir > > > ) {
229+ fn check_index < ' hir > ( cx : & LateContext < ' _ > , expr : & ' hir Expr < ' hir > , map : & mut UnindexMap < u64 , Vec < IndexEntry < ' hir > > > ) {
230230 if let ExprKind :: Index ( slice, index_lit, _) = expr. kind
231231 && cx. typeck_results ( ) . expr_ty_adjusted ( slice) . peel_refs ( ) . is_slice ( )
232232 && let Some ( index) = upper_index_expr ( index_lit)
@@ -274,7 +274,7 @@ fn check_index<'hir>(cx: &LateContext<'_>, expr: &'hir Expr<'hir>, map: &mut Unh
274274}
275275
276276/// Checks if the expression is an `assert!` expression and adds it to `asserts`
277- fn check_assert < ' hir > ( cx : & LateContext < ' _ > , expr : & ' hir Expr < ' hir > , map : & mut UnhashMap < u64 , Vec < IndexEntry < ' hir > > > ) {
277+ fn check_assert < ' hir > ( cx : & LateContext < ' _ > , expr : & ' hir Expr < ' hir > , map : & mut UnindexMap < u64 , Vec < IndexEntry < ' hir > > > ) {
278278 if let Some ( ( comparison, asserted_len, slice) ) = assert_len_expr ( cx, expr) {
279279 let hash = hash_expr ( cx, slice) ;
280280 let indexes = map. entry ( hash) . or_default ( ) ;
@@ -311,7 +311,7 @@ fn check_assert<'hir>(cx: &LateContext<'_>, expr: &'hir Expr<'hir>, map: &mut Un
311311/// Inspects indexes and reports lints.
312312///
313313/// Called at the end of this lint after all indexing and `assert!` expressions have been collected.
314- fn report_indexes ( cx : & LateContext < ' _ > , map : & UnhashMap < u64 , Vec < IndexEntry < ' _ > > > ) {
314+ fn report_indexes ( cx : & LateContext < ' _ > , map : & UnindexMap < u64 , Vec < IndexEntry < ' _ > > > ) {
315315 for bucket in map. values ( ) {
316316 for entry in bucket {
317317 let Some ( full_span) = entry
@@ -403,7 +403,7 @@ fn report_indexes(cx: &LateContext<'_>, map: &UnhashMap<u64, Vec<IndexEntry<'_>>
403403
404404impl LateLintPass < ' _ > for MissingAssertsForIndexing {
405405 fn check_body ( & mut self , cx : & LateContext < ' _ > , body : & Body < ' _ > ) {
406- let mut map = UnhashMap :: default ( ) ;
406+ let mut map = UnindexMap :: default ( ) ;
407407
408408 for_each_expr_without_closures ( body. value , |expr| {
409409 check_index ( cx, expr, & mut map) ;
0 commit comments