@@ -315,7 +315,7 @@ pub fn get_trait_def_id(cx: &LateContext<'_, '_>, path: &[&str]) -> Option<DefId
315
315
} ;
316
316
317
317
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) ,
319
319
Res :: Err => unreachable ! ( "this trait resolution is impossible: {:?}" , & path) ,
320
320
_ => None ,
321
321
}
@@ -448,10 +448,11 @@ pub fn is_entrypoint_fn(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
448
448
pub fn get_item_name ( cx : & LateContext < ' _ , ' _ > , expr : & Expr < ' _ > ) -> Option < Name > {
449
449
let parent_id = cx. tcx . hir ( ) . get_parent_item ( expr. hir_id ) ;
450
450
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 ) ,
455
456
_ => None ,
456
457
}
457
458
}
@@ -925,7 +926,7 @@ pub fn is_ctor_or_promotable_const_function(cx: &LateContext<'_, '_>, expr: &Exp
925
926
if let ExprKind :: Path ( ref qp) = fun. kind {
926
927
let res = cx. tables . qpath_res ( qp, fun. hir_id ) ;
927
928
return match res {
928
- def:: Res :: Def ( DefKind :: Variant , .. ) | Res :: Def ( DefKind :: Ctor ( ..) , _ ) => true ,
929
+ def:: Res :: Def ( DefKind :: Variant | DefKind :: Ctor ( ..) , .. ) => true ,
929
930
def:: Res :: Def ( _, def_id) => cx. tcx . is_promotable_const_fn ( def_id) ,
930
931
_ => false ,
931
932
} ;
0 commit comments