File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -77,17 +77,12 @@ impl_lint_pass!(LargeEnumVariant => [LARGE_ENUM_VARIANT]);
7777
7878impl < ' tcx > LateLintPass < ' tcx > for LargeEnumVariant {
7979 fn check_item ( & mut self , cx : & LateContext < ' tcx > , item : & Item < ' tcx > ) {
80- if in_external_macro ( cx. tcx . sess , item. span ) {
81- return ;
82- }
83- if let ItemKind :: Enum ( ref def, _) = item. kind {
84- let ty = cx. tcx . type_of ( item. owner_id ) . instantiate_identity ( ) ;
85- let ty:: Adt ( adt, subst) = ty. kind ( ) else {
86- panic ! ( "already checked whether this is an enum" )
87- } ;
88- if adt. variants ( ) . len ( ) <= 1 {
89- return ;
90- }
80+ if let ItemKind :: Enum ( ref def, _) = item. kind
81+ && let ty = cx. tcx . type_of ( item. owner_id ) . instantiate_identity ( )
82+ && let ty:: Adt ( adt, subst) = ty. kind ( )
83+ && adt. variants ( ) . len ( ) > 1
84+ && !in_external_macro ( cx. tcx . sess , item. span )
85+ {
9186 let variants_size = AdtVariantInfo :: new ( cx, * adt, subst) ;
9287
9388 let mut difference = variants_size[ 0 ] . size - variants_size[ 1 ] . size ;
You can’t perform that action at this time.
0 commit comments