mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-16 17:58:14 +00:00
Check if never type feature is enabled by TyCtxt before suggesting empty enum lint
This commit is contained in:
parent
61a3ee7935
commit
469281c0dd
1 changed files with 3 additions and 1 deletions
|
@ -44,7 +44,9 @@ impl<'tcx> LateLintPass<'tcx> for EmptyEnum {
|
|||
if let ItemKind::Enum(..) = item.kind {
|
||||
let ty = cx.tcx.type_of(did);
|
||||
let adt = ty.ty_adt_def().expect("already checked whether this is an enum");
|
||||
if adt.variants.is_empty() {
|
||||
|
||||
// Only suggest the never type if the feature is enabled
|
||||
if adt.variants.is_empty() && cx.tcx.features().never_type {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
EMPTY_ENUM,
|
||||
|
|
Loading…
Reference in a new issue