@@ -459,11 +459,7 @@ impl Integer {
459
459
}
460
460
}
461
461
462
- let at_least = if let Some ( i) = min_from_extern {
463
- i
464
- } else {
465
- min_default
466
- } ;
462
+ let at_least = min_from_extern. unwrap_or ( min_default) ;
467
463
468
464
// If there are no negative values, we can use the unsigned fit.
469
465
if min >= 0 {
@@ -571,13 +567,11 @@ impl<'a, 'gcx, 'tcx> Struct {
571
567
if can_optimize {
572
568
// This exhaustive match makes new reprs force the adder to modify this function.
573
569
// Otherwise, things can silently break.
574
- // Note the inversion, return true to stop matching .
570
+ // Note the inversion, return true to stop optimizing .
575
571
can_optimize = !reprs. iter ( ) . any ( |r| {
576
572
match * r {
577
- attr:: ReprAny => false ,
578
- attr:: ReprInt ( _) => false ,
579
- attr:: ReprExtern => true ,
580
- attr:: ReprPacked => true ,
573
+ attr:: ReprAny | attr:: ReprInt ( _) => false ,
574
+ attr:: ReprExtern | attr:: ReprPacked => true ,
581
575
attr:: ReprSimd => bug ! ( "Simd vectors should be represented as layout::Vector" )
582
576
}
583
577
} ) ;
@@ -588,7 +582,7 @@ impl<'a, 'gcx, 'tcx> Struct {
588
582
StructKind :: MaybeUnsizedUnivariant => ( can_optimize, false ) ,
589
583
StructKind :: EnumVariant => {
590
584
assert ! ( fields. len( ) >= 1 , "Enum variants must have discriminants." ) ;
591
- ( can_optimize || fields[ 0 ] . size ( dl) . bytes ( ) == 1 , true )
585
+ ( can_optimize && fields[ 0 ] . size ( dl) . bytes ( ) == 1 , true )
592
586
}
593
587
} ;
594
588
@@ -1189,7 +1183,7 @@ impl<'a, 'gcx, 'tcx> Layout {
1189
1183
} ) ;
1190
1184
}
1191
1185
1192
- if !def. is_enum ( ) || def. variants . len ( ) == 1 && hints. len ( ) == 0 {
1186
+ if !def. is_enum ( ) || def. variants . len ( ) == 1 && hints. is_empty ( ) {
1193
1187
// Struct, or union, or univariant enum equivalent to a struct.
1194
1188
// (Typechecking will reject discriminant-sizing attrs.)
1195
1189
@@ -1239,7 +1233,7 @@ impl<'a, 'gcx, 'tcx> Layout {
1239
1233
v. fields . iter ( ) . map ( |field| field. ty ( tcx, substs) ) . collect :: < Vec < _ > > ( )
1240
1234
} ) . collect :: < Vec < _ > > ( ) ;
1241
1235
1242
- if variants. len ( ) == 2 && hints. len ( ) == 0 {
1236
+ if variants. len ( ) == 2 && hints. is_empty ( ) {
1243
1237
// Nullable pointer optimization
1244
1238
for discr in 0 ..2 {
1245
1239
let other_fields = variants[ 1 - discr] . iter ( ) . map ( |ty| {
0 commit comments