@@ -3,7 +3,7 @@ use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item};
33use clippy_utils:: visitors:: for_each_expr_with_closures;
44use clippy_utils:: { get_enclosing_block, path_to_local_id} ;
55use core:: ops:: ControlFlow ;
6- use rustc_hir:: { Block , ExprKind , HirId , LangItem , Local , Node , PatKind } ;
6+ use rustc_hir:: { Block , ExprKind , HirId , LangItem , LetStmt , Node , PatKind } ;
77use rustc_lint:: { LateContext , LateLintPass } ;
88use rustc_session:: declare_lint_pass;
99use rustc_span:: symbol:: sym;
@@ -58,7 +58,7 @@ static COLLECTIONS: [Symbol; 9] = [
5858] ;
5959
6060impl < ' tcx > LateLintPass < ' tcx > for CollectionIsNeverRead {
61- fn check_local ( & mut self , cx : & LateContext < ' tcx > , local : & ' tcx Local < ' tcx > ) {
61+ fn check_local ( & mut self , cx : & LateContext < ' tcx > , local : & ' tcx LetStmt < ' tcx > ) {
6262 // Look for local variables whose type is a container. Search surrounding bock for read access.
6363 if match_acceptable_type ( cx, local, & COLLECTIONS )
6464 && let PatKind :: Binding ( _, local_id, _, _) = local. pat . kind
@@ -70,7 +70,7 @@ impl<'tcx> LateLintPass<'tcx> for CollectionIsNeverRead {
7070 }
7171}
7272
73- fn match_acceptable_type ( cx : & LateContext < ' _ > , local : & Local < ' _ > , collections : & [ rustc_span:: Symbol ] ) -> bool {
73+ fn match_acceptable_type ( cx : & LateContext < ' _ > , local : & LetStmt < ' _ > , collections : & [ rustc_span:: Symbol ] ) -> bool {
7474 let ty = cx. typeck_results ( ) . pat_ty ( local. pat ) ;
7575 collections. iter ( ) . any ( |& sym| is_type_diagnostic_item ( cx, ty, sym) )
7676 // String type is a lang item but not a diagnostic item for now so we need a separate check
0 commit comments