about summary refs log tree commit diff
path: root/clippy_lints/src/unneeded_struct_pattern.rs
diff options
context:
space:
mode:
authorMaja Kądziołka <maya@compilercrim.es>2025-03-03 12:54:26 +0100
committerMaja Kądziołka <maya@compilercrim.es>2025-03-07 16:16:36 +0100
commit10cf3cb945b413c0fb81cf13c4bf4db762ba5377 (patch)
treea122add349a1643c05b645f8edd3330f5e5f46af /clippy_lints/src/unneeded_struct_pattern.rs
parente5c1d1cb7ee727246a6d453f52b5707e264387d5 (diff)
Add helper methods checking for "#[non_exhaustive] that's active"
A check for `#[non_exhaustive]` is often done in combination with
checking whether the type is local to the crate, in a variety of ways.
Create a helper method and standardize on it as the way to check for
this.
Diffstat (limited to 'clippy_lints/src/unneeded_struct_pattern.rs')
-rw-r--r--clippy_lints/src/unneeded_struct_pattern.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/unneeded_struct_pattern.rs b/clippy_lints/src/unneeded_struct_pattern.rs
index a74eab8b6ae..3326dea8c5d 100644
--- a/clippy_lints/src/unneeded_struct_pattern.rs
+++ b/clippy_lints/src/unneeded_struct_pattern.rs
@@ -51,7 +51,7 @@ impl LateLintPass<'_> for UnneededStructPattern {
             let variant = cx.tcx.adt_def(enum_did).variant_with_id(did);
 
             let has_only_fields_brackets = variant.ctor.is_some() && variant.fields.is_empty();
-            let non_exhaustive_activated = !variant.def_id.is_local() && variant.is_field_list_non_exhaustive();
+            let non_exhaustive_activated = variant.field_list_has_applicable_non_exhaustive();
             if !has_only_fields_brackets || non_exhaustive_activated {
                 return;
             }