1
1
use clippy_utils:: diagnostics:: span_lint_hir;
2
2
use clippy_utils:: ty:: contains_ty;
3
3
use 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 } ;
5
5
use rustc_infer:: infer:: TyCtxtInferExt ;
6
6
use rustc_lint:: { LateContext , LateLintPass } ;
7
7
use rustc_middle:: mir:: FakeReadCause ;
@@ -132,7 +132,10 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
132
132
// TODO: Replace with Map::is_argument(..) when it's fixed
133
133
fn is_argument ( map : rustc_middle:: hir:: map:: Map < ' _ > , id : HirId ) -> bool {
134
134
match map. find ( id) {
135
- Some ( Node :: Binding ( _) ) => ( ) ,
135
+ Some ( Node :: Pat ( Pat {
136
+ kind : PatKind :: Binding ( ..) ,
137
+ ..
138
+ } ) ) => ( ) ,
136
139
_ => return false ,
137
140
}
138
141
@@ -144,15 +147,6 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
144
147
if cmt. place . projections . is_empty ( ) {
145
148
if let PlaceBase :: Local ( lid) = cmt. place . base {
146
149
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
- }
156
150
}
157
151
}
158
152
}
0 commit comments