We don't need to check for non-exhaustive fields
Fields are disallowed so checking the top attribute is enough.
This commit is contained in:
parent
fc37633580
commit
b3e6d52e49
1 changed files with 1 additions and 2 deletions
|
@ -1114,8 +1114,7 @@ fn is_niche_optimization_candidate<'tcx>(
|
||||||
|
|
||||||
match ty.kind() {
|
match ty.kind() {
|
||||||
ty::Adt(ty_def, _) => {
|
ty::Adt(ty_def, _) => {
|
||||||
let non_exhaustive = ty_def.is_variant_list_non_exhaustive()
|
let non_exhaustive = ty_def.is_variant_list_non_exhaustive();
|
||||||
|| ty_def.variants().iter().any(|variant| variant.is_field_list_non_exhaustive());
|
|
||||||
let contains_no_fields = ty_def.all_fields().next().is_none();
|
let contains_no_fields = ty_def.all_fields().next().is_none();
|
||||||
|
|
||||||
!non_exhaustive && contains_no_fields
|
!non_exhaustive && contains_no_fields
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue