11use clippy_utils:: diagnostics:: span_lint_hir;
22use clippy_utils:: ty:: contains_ty;
33use rustc_hir:: intravisit;
4- use rustc_hir:: { self , AssocItemKind , Body , FnDecl , HirId , HirIdSet , Impl , ItemKind , Node } ;
4+ use rustc_hir:: { self , AssocItemKind , Body , FnDecl , HirId , HirIdSet , Impl , ItemKind , Node , Pat , PatKind } ;
55use rustc_infer:: infer:: TyCtxtInferExt ;
66use rustc_lint:: { LateContext , LateLintPass } ;
77use rustc_middle:: mir:: FakeReadCause ;
@@ -132,7 +132,10 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
132132// TODO: Replace with Map::is_argument(..) when it's fixed
133133fn is_argument ( map : rustc_middle:: hir:: map:: Map < ' _ > , id : HirId ) -> bool {
134134 match map. find ( id) {
135- Some ( Node :: Binding ( _) ) => ( ) ,
135+ Some ( Node :: Pat ( Pat {
136+ kind : PatKind :: Binding ( ..) ,
137+ ..
138+ } ) ) => ( ) ,
136139 _ => return false ,
137140 }
138141
@@ -144,15 +147,6 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
144147 if cmt. place . projections . is_empty ( ) {
145148 if let PlaceBase :: Local ( lid) = cmt. place . base {
146149 self . set . remove ( & lid) ;
147- let map = & self . cx . tcx . hir ( ) ;
148- if let Some ( Node :: Binding ( _) ) = map. find ( cmt. hir_id ) {
149- if self . set . contains ( & lid) {
150- // let y = x where x is known
151- // remove x, insert y
152- self . set . insert ( cmt. hir_id ) ;
153- self . set . remove ( & lid) ;
154- }
155- }
156150 }
157151 }
158152 }
0 commit comments