File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 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> {
252252 GenericParamKind :: Type { .. } => DefKind :: TyParam ,
253253 GenericParamKind :: Const { .. } => DefKind :: ConstParam ,
254254 } ,
255+ Node :: Crate ( _) => DefKind :: Mod ,
255256 Node :: Stmt ( _)
256257 | Node :: PathSegment ( _)
257258 | Node :: Ty ( _)
@@ -263,8 +264,7 @@ impl<'hir> Map<'hir> {
263264 | Node :: Arm ( _)
264265 | Node :: Lifetime ( _)
265266 | Node :: Visibility ( _)
266- | Node :: Block ( _)
267- | Node :: Crate ( _) => return None ,
267+ | Node :: Block ( _) => return None ,
268268 } ;
269269 Some ( def_kind)
270270 }
@@ -523,9 +523,7 @@ impl<'hir> Map<'hir> {
523523
524524 /// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found.
525525 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 )
529527 }
530528
531529 /// 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> {
307307 | Node :: Ctor ( ..)
308308 | Node :: Field ( _)
309309 | Node :: Ty ( _)
310+ | Node :: Crate ( _)
310311 | Node :: MacroDef ( _) => { }
311312 _ => {
312313 bug ! (
You can’t perform that action at this time.
0 commit comments