@@ -8,7 +8,7 @@ use clippy_utils::visitors::for_each_expr_without_closures;
8
8
use clippy_utils:: { eq_expr_value, hash_expr, higher} ;
9
9
use rustc_ast:: { LitKind , RangeLimits } ;
10
10
use rustc_data_structures:: packed:: Pu128 ;
11
- use rustc_data_structures:: unhash:: UnhashMap ;
11
+ use rustc_data_structures:: unhash:: UnindexMap ;
12
12
use rustc_errors:: { Applicability , Diag } ;
13
13
use rustc_hir:: { BinOp , Block , Body , Expr , ExprKind , UnOp } ;
14
14
use rustc_lint:: { LateContext , LateLintPass } ;
@@ -226,7 +226,7 @@ fn upper_index_expr(expr: &Expr<'_>) -> Option<usize> {
226
226
}
227
227
228
228
/// 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 > > > ) {
230
230
if let ExprKind :: Index ( slice, index_lit, _) = expr. kind
231
231
&& cx. typeck_results ( ) . expr_ty_adjusted ( slice) . peel_refs ( ) . is_slice ( )
232
232
&& 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
274
274
}
275
275
276
276
/// 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 > > > ) {
278
278
if let Some ( ( comparison, asserted_len, slice) ) = assert_len_expr ( cx, expr) {
279
279
let hash = hash_expr ( cx, slice) ;
280
280
let indexes = map. entry ( hash) . or_default ( ) ;
@@ -311,7 +311,7 @@ fn check_assert<'hir>(cx: &LateContext<'_>, expr: &'hir Expr<'hir>, map: &mut Un
311
311
/// Inspects indexes and reports lints.
312
312
///
313
313
/// 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 < ' _ > > > ) {
315
315
for bucket in map. values ( ) {
316
316
for entry in bucket {
317
317
let Some ( full_span) = entry
@@ -403,7 +403,7 @@ fn report_indexes(cx: &LateContext<'_>, map: &UnhashMap<u64, Vec<IndexEntry<'_>>
403
403
404
404
impl LateLintPass < ' _ > for MissingAssertsForIndexing {
405
405
fn check_body ( & mut self , cx : & LateContext < ' _ > , body : & Body < ' _ > ) {
406
- let mut map = UnhashMap :: default ( ) ;
406
+ let mut map = UnindexMap :: default ( ) ;
407
407
408
408
for_each_expr_without_closures ( body. value , |expr| {
409
409
check_index ( cx, expr, & mut map) ;
0 commit comments