Skip to content

Commit 100cd22

Browse files
committed
We don't need to check for non-exhaustive fields
Fields are disallowed so checking the top attribute is enough.
1 parent 74d8244 commit 100cd22

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compiler/rustc_lint/src/types.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,8 +1069,7 @@ fn is_niche_optimization_candidate<'tcx>(
10691069

10701070
match ty.kind() {
10711071
ty::Adt(ty_def, _) => {
1072-
let non_exhaustive = ty_def.is_variant_list_non_exhaustive()
1073-
|| ty_def.variants().iter().any(|variant| variant.is_field_list_non_exhaustive());
1072+
let non_exhaustive = ty_def.is_variant_list_non_exhaustive();
10741073
let contains_no_fields = ty_def.all_fields().next().is_none();
10751074

10761075
!non_exhaustive && contains_no_fields

0 commit comments

Comments
 (0)