@@ -609,14 +609,12 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
609609 // If the trait is private, add the impl items to `private_traits` so they don't get
610610 // reported for missing docs.
611611 let real_trait = trait_ref. path . res . def_id ( ) ;
612- if let Some ( def_id) = real_trait. as_local ( ) {
613- let hir_id = cx. tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ;
614- if let Some ( Node :: Item ( item) ) = cx. tcx . hir ( ) . find ( hir_id) {
615- if let hir:: VisibilityKind :: Inherited = item. vis . node {
616- for impl_item_ref in items {
617- self . private_traits . insert ( impl_item_ref. id . hir_id ( ) ) ;
618- }
619- }
612+ let Some ( def_id) = real_trait. as_local ( ) else { return } ;
613+ let hir_id = cx. tcx . hir ( ) . local_def_id_to_hir_id ( def_id) ;
614+ let Some ( Node :: Item ( item) ) = cx. tcx . hir ( ) . find ( hir_id) else { return } ;
615+ if let hir:: VisibilityKind :: Inherited = item. vis . node {
616+ for impl_item_ref in items {
617+ self . private_traits . insert ( impl_item_ref. id . hir_id ( ) ) ;
620618 }
621619 }
622620 return ;
@@ -829,9 +827,8 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
829827 _ => return ,
830828 }
831829
832- let debug = match cx. tcx . get_diagnostic_item ( sym:: Debug ) {
833- Some ( debug) => debug,
834- None => return ,
830+ let Some ( debug) = cx. tcx . get_diagnostic_item ( sym:: Debug ) else {
831+ return
835832 } ;
836833
837834 if self . impling_types . is_none ( ) {
@@ -1509,9 +1506,8 @@ impl TypeAliasBounds {
15091506
15101507impl < ' tcx > LateLintPass < ' tcx > for TypeAliasBounds {
15111508 fn check_item ( & mut self , cx : & LateContext < ' _ > , item : & hir:: Item < ' _ > ) {
1512- let ( ty, type_alias_generics) = match item. kind {
1513- hir:: ItemKind :: TyAlias ( ref ty, ref generics) => ( & * ty, generics) ,
1514- _ => return ,
1509+ let hir:: ItemKind :: TyAlias ( ty, type_alias_generics) = & item. kind else {
1510+ return
15151511 } ;
15161512 if let hir:: TyKind :: OpaqueDef ( ..) = ty. kind {
15171513 // Bounds are respected for `type X = impl Trait`
@@ -2266,16 +2262,15 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
22662262 // and should check for them here.
22672263 match predicate. bounded_ty . kind {
22682264 hir:: TyKind :: Path ( hir:: QPath :: Resolved ( None , ref path) ) => {
2269- if let Res :: Def ( DefKind :: TyParam , def_id) = path. res {
2270- let index = ty_generics. param_def_id_to_index [ & def_id] ;
2271- (
2272- Self :: lifetimes_outliving_type ( inferred_outlives, index) ,
2273- & predicate. bounds ,
2274- predicate. span ,
2275- )
2276- } else {
2277- continue ;
2278- }
2265+ let Res :: Def ( DefKind :: TyParam , def_id) = path. res else {
2266+ continue
2267+ } ;
2268+ let index = ty_generics. param_def_id_to_index [ & def_id] ;
2269+ (
2270+ Self :: lifetimes_outliving_type ( inferred_outlives, index) ,
2271+ & predicate. bounds ,
2272+ predicate. span ,
2273+ )
22792274 }
22802275 _ => {
22812276 continue ;
@@ -3216,18 +3211,17 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels {
32163211 for ( idx, _) in statement. match_indices ( ':' ) {
32173212 let possible_label = statement[ start_idx..idx] . trim ( ) ;
32183213 let mut chars = possible_label. chars ( ) ;
3219- if let Some ( c) = chars. next ( ) {
3220- // A label starts with an alphabetic character or . or _ and continues with alphanumeric characters, _, or $
3221- if ( c. is_alphabetic ( ) || matches ! ( c, '.' | '_' ) )
3222- && chars. all ( |c| c. is_alphanumeric ( ) || matches ! ( c, '_' | '$' ) )
3223- {
3224- found_labels. push ( possible_label) ;
3225- } else {
3226- // If we encounter a non-label, there cannot be any further labels, so stop checking
3227- break ;
3228- }
3229- } else {
3214+ let Some ( c) = chars. next ( ) else {
32303215 // Empty string means a leading ':' in this section, which is not a label
3216+ break
3217+ } ;
3218+ // A label starts with an alphabetic character or . or _ and continues with alphanumeric characters, _, or $
3219+ if ( c. is_alphabetic ( ) || matches ! ( c, '.' | '_' ) )
3220+ && chars. all ( |c| c. is_alphanumeric ( ) || matches ! ( c, '_' | '$' ) )
3221+ {
3222+ found_labels. push ( possible_label) ;
3223+ } else {
3224+ // If we encounter a non-label, there cannot be any further labels, so stop checking
32313225 break ;
32323226 }
32333227
0 commit comments