@@ -5,7 +5,6 @@ use rustc_hir::def_id::{DefId, LocalDefId};
5
5
use rustc_hir:: hir_id:: HirId ;
6
6
use rustc_hir:: intravisit;
7
7
use rustc_hir:: Node ;
8
- use rustc_middle:: hir:: nested_filter;
9
8
use rustc_middle:: mir:: visit:: { MutatingUseContext , PlaceContext , Visitor } ;
10
9
use rustc_middle:: mir:: * ;
11
10
use rustc_middle:: ty:: query:: Providers ;
@@ -409,11 +408,6 @@ struct UnusedUnsafeVisitor<'a, 'tcx> {
409
408
}
410
409
411
410
impl < ' tcx > intravisit:: Visitor < ' tcx > for UnusedUnsafeVisitor < ' _ , ' tcx > {
412
- type NestedFilter = nested_filter:: OnlyBodies ;
413
- fn nested_visit_map ( & mut self ) -> Self :: Map {
414
- self . tcx . hir ( )
415
- }
416
-
417
411
fn visit_block ( & mut self , block : & ' tcx hir:: Block < ' tcx > ) {
418
412
if let hir:: BlockCheckMode :: UnsafeBlock ( hir:: UnsafeSource :: UserProvided ) = block. rules {
419
413
let used = match self . tcx . lint_level_at_node ( UNUSED_UNSAFE , block. hir_id ) {
@@ -440,7 +434,18 @@ impl<'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'_, 'tcx> {
440
434
intravisit:: walk_block ( self , block) ;
441
435
}
442
436
443
- fn visit_anon_const ( & mut self , _c : & ' tcx hir:: AnonConst ) { }
437
+ fn visit_fn (
438
+ & mut self ,
439
+ fk : intravisit:: FnKind < ' tcx > ,
440
+ _fd : & ' tcx hir:: FnDecl < ' tcx > ,
441
+ b : hir:: BodyId ,
442
+ _s : rustc_span:: Span ,
443
+ _id : HirId ,
444
+ ) {
445
+ if matches ! ( fk, intravisit:: FnKind :: Closure ) {
446
+ self . visit_body ( self . tcx . hir ( ) . body ( b) )
447
+ }
448
+ }
444
449
}
445
450
446
451
fn check_unused_unsafe (
0 commit comments