diff options
| author | Arvind Mukund <armu30@gmail.com> | 2024-03-09 12:35:17 -0800 |
|---|---|---|
| committer | Arvind Mukund <armu30@gmail.com> | 2024-04-23 21:15:36 -0700 |
| commit | b3e6d52e49345db9e59c955b79ca3ea7cf4f7afc (patch) | |
| tree | 2ad96baddc0fada265876142ba07370f331c1ac0 | |
| parent | fc37633580af9da06ab5e01e595a51f1e7c54cc7 (diff) | |
| download | rust-b3e6d52e49345db9e59c955b79ca3ea7cf4f7afc.tar.gz rust-b3e6d52e49345db9e59c955b79ca3ea7cf4f7afc.zip | |
We don't need to check for non-exhaustive fields
Fields are disallowed so checking the top attribute is enough.
| -rw-r--r-- | compiler/rustc_lint/src/types.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 001bf27afb9..ae118ffbf4c 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -1114,8 +1114,7 @@ fn is_niche_optimization_candidate<'tcx>( match ty.kind() { ty::Adt(ty_def, _) => { - let non_exhaustive = ty_def.is_variant_list_non_exhaustive() - || ty_def.variants().iter().any(|variant| variant.is_field_list_non_exhaustive()); + let non_exhaustive = ty_def.is_variant_list_non_exhaustive(); let contains_no_fields = ty_def.all_fields().next().is_none(); !non_exhaustive && contains_no_fields |
