mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
clean-up a bit
This commit is contained in:
@@ -62,11 +62,10 @@
|
||||
|
||||
impl LateLintPass<'_> for EmptyEnum {
|
||||
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
|
||||
if let ItemKind::Enum(..) = item.kind
|
||||
if let ItemKind::Enum(.., def) = item.kind
|
||||
&& def.variants.is_empty()
|
||||
// Only suggest the `never_type` if the feature is enabled
|
||||
&& cx.tcx.features().never_type()
|
||||
&& let Some(adt) = cx.tcx.type_of(item.owner_id).instantiate_identity().ty_adt_def()
|
||||
&& adt.variants().is_empty()
|
||||
{
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![allow(dead_code)]
|
||||
#![warn(clippy::empty_enum)]
|
||||
// Enable never type to test empty enum lint
|
||||
#![feature(never_type)]
|
||||
|
||||
enum Empty {}
|
||||
//~^ empty_enum
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//@ check-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![warn(clippy::empty_enum)]
|
||||
|
||||
// `never_type` is not enabled; this test has no stderr file
|
||||
|
||||
Reference in New Issue
Block a user