Skip to content

Commit 8e1f6dc

Browse files
committed
enum detection by style convention
1 parent ff2487b commit 8e1f6dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/enum_glob_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! lint on `use`ing all variants of an enum
22
33
use rustc::hir::*;
4-
use rustc::hir::def::Def;
54
use rustc::lint::{LateLintPass, LintPass, LateContext, LintArray};
65
use syntax::ast::NodeId;
76
use syntax::codemap::Span;
@@ -50,7 +49,8 @@ impl EnumGlobUse {
5049
if let ItemUse(ref path, UseKind::Glob) = item.node {
5150
// FIXME: ask jseyfried why the qpath.def for `use std::cmp::Ordering::*;`
5251
// extracted through `ItemUse(ref qpath, UseKind::Glob)` is a `Mod` and not an `Enum`
53-
if let Def::Enum(_) = path.def {
52+
//if let Def::Enum(_) = path.def {
53+
if path.segments.last().and_then(|seg| seg.name.as_str().chars().next()).map_or(false, char::is_uppercase) {
5454
span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants");
5555
}
5656
}

0 commit comments

Comments
 (0)