File tree 2 files changed +4
-5
lines changed
2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ impl<'hir> Map<'hir> {
252
252
GenericParamKind :: Type { .. } => DefKind :: TyParam ,
253
253
GenericParamKind :: Const { .. } => DefKind :: ConstParam ,
254
254
} ,
255
+ Node :: Crate ( _) => DefKind :: Mod ,
255
256
Node :: Stmt ( _)
256
257
| Node :: PathSegment ( _)
257
258
| Node :: Ty ( _)
@@ -263,8 +264,7 @@ impl<'hir> Map<'hir> {
263
264
| Node :: Arm ( _)
264
265
| Node :: Lifetime ( _)
265
266
| Node :: Visibility ( _)
266
- | Node :: Block ( _)
267
- | Node :: Crate ( _) => return None ,
267
+ | Node :: Block ( _) => return None ,
268
268
} ;
269
269
Some ( def_kind)
270
270
}
@@ -523,9 +523,7 @@ impl<'hir> Map<'hir> {
523
523
524
524
/// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found.
525
525
pub fn find ( & self , hir_id : HirId ) -> Option < Node < ' hir > > {
526
- self . find_entry ( hir_id) . and_then ( |entry| {
527
- if let Node :: Crate ( ..) = entry. node { None } else { Some ( entry. node ) }
528
- } )
526
+ self . find_entry ( hir_id) . map ( |entry| entry. node )
529
527
}
530
528
531
529
/// Similar to `get_parent`; returns the parent HIR Id, or just `hir_id` if there
Original file line number Diff line number Diff line change @@ -307,6 +307,7 @@ impl<'tcx> ReachableContext<'tcx> {
307
307
| Node :: Ctor ( ..)
308
308
| Node :: Field ( _)
309
309
| Node :: Ty ( _)
310
+ | Node :: Crate ( _)
310
311
| Node :: MacroDef ( _) => { }
311
312
_ => {
312
313
bug ! (
You can’t perform that action at this time.
0 commit comments