@@ -67,14 +67,14 @@ declare_clippy_lint! {
6767}
6868declare_lint_pass ! ( MissingAssertsForIndexing => [ MISSING_ASSERTS_FOR_INDEXING ] ) ;
6969
70- fn report_lint < F > ( cx : & LateContext < ' _ > , full_span : Span , msg : & ' static str , indexes : & [ Span ] , f : F )
70+ fn report_lint < F > ( cx : & LateContext < ' _ > , full_span : Span , msg : & ' static str , indexes : Vec < Span > , f : F )
7171where
7272 F : FnOnce ( & mut Diag < ' _ , ( ) > ) ,
7373{
7474 span_lint_and_then ( cx, MISSING_ASSERTS_FOR_INDEXING , full_span, msg, |diag| {
7575 f ( diag) ;
7676 for span in indexes {
77- diag. span_note ( * span, "slice indexed here" ) ;
77+ diag. span_note ( span, "slice indexed here" ) ;
7878 }
7979 diag. note ( "asserting the length before indexing will elide bounds checks" ) ;
8080 } ) ;
@@ -354,8 +354,8 @@ fn check_assert<'hir>(cx: &LateContext<'_>, expr: &'hir Expr<'hir>, map: &mut Un
354354/// Inspects indexes and reports lints.
355355///
356356/// Called at the end of this lint after all indexing and `assert!` expressions have been collected.
357- fn report_indexes ( cx : & LateContext < ' _ > , map : & UnindexMap < u64 , Vec < IndexEntry < ' _ > > > ) {
358- for bucket in map. values ( ) {
357+ fn report_indexes ( cx : & LateContext < ' _ > , map : UnindexMap < u64 , Vec < IndexEntry < ' _ > > > ) {
358+ for bucket in map. into_values ( ) {
359359 for entry in bucket {
360360 let Some ( full_span) = entry
361361 . index_spans ( )
@@ -365,12 +365,12 @@ fn report_indexes(cx: &LateContext<'_>, map: &UnindexMap<u64, Vec<IndexEntry<'_>
365365 continue ;
366366 } ;
367367
368- match * entry {
368+ match entry {
369369 IndexEntry :: AssertWithIndex {
370370 highest_index,
371371 is_first_highest,
372372 asserted_len,
373- ref indexes,
373+ indexes,
374374 comparison,
375375 assert_span,
376376 slice,
@@ -433,7 +433,7 @@ fn report_indexes(cx: &LateContext<'_>, map: &UnindexMap<u64, Vec<IndexEntry<'_>
433433 }
434434 } ,
435435 IndexEntry :: IndexWithoutAssert {
436- ref indexes,
436+ indexes,
437437 highest_index,
438438 is_first_highest,
439439 slice,
@@ -469,6 +469,6 @@ impl LateLintPass<'_> for MissingAssertsForIndexing {
469469 ControlFlow :: < !, ( ) > :: Continue ( ( ) )
470470 } ) ;
471471
472- report_indexes ( cx, & map) ;
472+ report_indexes ( cx, map) ;
473473 }
474474}
0 commit comments