@@ -315,7 +315,7 @@ pub fn get_trait_def_id(cx: &LateContext<'_, '_>, path: &[&str]) -> Option<DefId
315315 } ;
316316
317317 match res {
318- Res :: Def ( DefKind :: Trait , trait_id ) | Res :: Def ( DefKind :: TraitAlias , trait_id) => Some ( trait_id) ,
318+ Res :: Def ( DefKind :: Trait | DefKind :: TraitAlias , trait_id) => Some ( trait_id) ,
319319 Res :: Err => unreachable ! ( "this trait resolution is impossible: {:?}" , & path) ,
320320 _ => None ,
321321 }
@@ -448,10 +448,11 @@ pub fn is_entrypoint_fn(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
448448pub fn get_item_name ( cx : & LateContext < ' _ , ' _ > , expr : & Expr < ' _ > ) -> Option < Name > {
449449 let parent_id = cx. tcx . hir ( ) . get_parent_item ( expr. hir_id ) ;
450450 match cx. tcx . hir ( ) . find ( parent_id) {
451- Some ( Node :: Item ( & Item { ref ident, .. } ) ) => Some ( ident. name ) ,
452- Some ( Node :: TraitItem ( & TraitItem { ident, .. } ) ) | Some ( Node :: ImplItem ( & ImplItem { ident, .. } ) ) => {
453- Some ( ident. name )
454- } ,
451+ Some (
452+ Node :: Item ( Item { ident, .. } )
453+ | Node :: TraitItem ( TraitItem { ident, .. } )
454+ | Node :: ImplItem ( ImplItem { ident, .. } ) ,
455+ ) => Some ( ident. name ) ,
455456 _ => None ,
456457 }
457458}
@@ -925,7 +926,7 @@ pub fn is_ctor_or_promotable_const_function(cx: &LateContext<'_, '_>, expr: &Exp
925926 if let ExprKind :: Path ( ref qp) = fun. kind {
926927 let res = cx. tables . qpath_res ( qp, fun. hir_id ) ;
927928 return match res {
928- def:: Res :: Def ( DefKind :: Variant , .. ) | Res :: Def ( DefKind :: Ctor ( ..) , _ ) => true ,
929+ def:: Res :: Def ( DefKind :: Variant | DefKind :: Ctor ( ..) , .. ) => true ,
929930 def:: Res :: Def ( _, def_id) => cx. tcx . is_promotable_const_fn ( def_id) ,
930931 _ => false ,
931932 } ;
0 commit comments