Skip to content

Commit b3e6d52

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 fc37633 commit b3e6d52

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
@@ -1114,8 +1114,7 @@ fn is_niche_optimization_candidate<'tcx>(
11141114

11151115
match ty.kind() {
11161116
ty::Adt(ty_def, _) => {
1117-
let non_exhaustive = ty_def.is_variant_list_non_exhaustive()
1118-
|| ty_def.variants().iter().any(|variant| variant.is_field_list_non_exhaustive());
1117+
let non_exhaustive = ty_def.is_variant_list_non_exhaustive();
11191118
let contains_no_fields = ty_def.all_fields().next().is_none();
11201119

11211120
!non_exhaustive && contains_no_fields

0 commit comments

Comments
 (0)