Skip to content

Commit 9dfd60c

Browse files
committed
Remove extraneous #[non_exhaustive] check in lint
1 parent e683e3e commit 9dfd60c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

clippy_lints/src/manual_non_exhaustive.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,14 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
200200
enum_span,
201201
"this seems like a manual implementation of the non-exhaustive pattern",
202202
|diag| {
203-
if !cx.tcx.adt_def(enum_id).is_variant_list_non_exhaustive()
204-
&& let header_span = cx.sess().source_map().span_until_char(enum_span, '{')
205-
&& let Some(snippet) = snippet_opt(cx, header_span)
206-
{
207-
diag.span_suggestion(
208-
header_span,
209-
"add the attribute",
210-
format!("#[non_exhaustive] {snippet}"),
211-
Applicability::Unspecified,
212-
);
203+
let header_span = cx.sess().source_map().span_until_char(enum_span, '{');
204+
if let Some(snippet) = snippet_opt(cx, header_span) {
205+
diag.span_suggestion(
206+
header_span,
207+
"add the attribute",
208+
format!("#[non_exhaustive] {snippet}"),
209+
Applicability::Unspecified,
210+
);
213211
}
214212
diag.span_help(variant_span, "remove this variant");
215213
},

0 commit comments

Comments
 (0)