diff options
| author | Victor Song <vms2@rice.edu> | 2023-10-01 09:54:45 -0500 |
|---|---|---|
| committer | Victor Song <vms2@rice.edu> | 2023-10-01 09:54:45 -0500 |
| commit | 9dfd60cf4f33c9af8e37d4a4956f56626bac2b3c (patch) | |
| tree | b95126049cc48762b3d4a8d65638741e2a98d372 | |
| parent | e683e3eeac5603296c328ff45c9e5bb911327756 (diff) | |
| download | rust-9dfd60cf4f33c9af8e37d4a4956f56626bac2b3c.tar.gz rust-9dfd60cf4f33c9af8e37d4a4956f56626bac2b3c.zip | |
Remove extraneous `#[non_exhaustive]` check in lint
| -rw-r--r-- | clippy_lints/src/manual_non_exhaustive.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/clippy_lints/src/manual_non_exhaustive.rs b/clippy_lints/src/manual_non_exhaustive.rs index 9fe55d819da..c12727c4a28 100644 --- a/clippy_lints/src/manual_non_exhaustive.rs +++ b/clippy_lints/src/manual_non_exhaustive.rs @@ -200,16 +200,14 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum { enum_span, "this seems like a manual implementation of the non-exhaustive pattern", |diag| { - if !cx.tcx.adt_def(enum_id).is_variant_list_non_exhaustive() - && let header_span = cx.sess().source_map().span_until_char(enum_span, '{') - && let Some(snippet) = snippet_opt(cx, header_span) - { - diag.span_suggestion( - header_span, - "add the attribute", - format!("#[non_exhaustive] {snippet}"), - Applicability::Unspecified, - ); + let header_span = cx.sess().source_map().span_until_char(enum_span, '{'); + if let Some(snippet) = snippet_opt(cx, header_span) { + diag.span_suggestion( + header_span, + "add the attribute", + format!("#[non_exhaustive] {snippet}"), + Applicability::Unspecified, + ); } diag.span_help(variant_span, "remove this variant"); }, |
