Skip to content

Commit 469281c

Browse files
committed
Check if never type feature is enabled by TyCtxt before suggesting empty enum lint
1 parent 61a3ee7 commit 469281c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_lints/src/empty_enum.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ impl<'tcx> LateLintPass<'tcx> for EmptyEnum {
4444
if let ItemKind::Enum(..) = item.kind {
4545
let ty = cx.tcx.type_of(did);
4646
let adt = ty.ty_adt_def().expect("already checked whether this is an enum");
47-
if adt.variants.is_empty() {
47+
48+
// Only suggest the never type if the feature is enabled
49+
if adt.variants.is_empty() && cx.tcx.features().never_type {
4850
span_lint_and_help(
4951
cx,
5052
EMPTY_ENUM,

0 commit comments

Comments
 (0)