From 8e1f6dce408deb92affe2099324a5cc7740b6567 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Fri, 2 Dec 2016 19:30:00 +0100 Subject: [PATCH] enum detection by style convention --- clippy_lints/src/enum_glob_use.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/enum_glob_use.rs b/clippy_lints/src/enum_glob_use.rs index 7992c4966b2..a47426b03ef 100644 --- a/clippy_lints/src/enum_glob_use.rs +++ b/clippy_lints/src/enum_glob_use.rs @@ -1,7 +1,6 @@ //! lint on `use`ing all variants of an enum use rustc::hir::*; -use rustc::hir::def::Def; use rustc::lint::{LateLintPass, LintPass, LateContext, LintArray}; use syntax::ast::NodeId; use syntax::codemap::Span; @@ -50,7 +49,8 @@ impl EnumGlobUse { if let ItemUse(ref path, UseKind::Glob) = item.node { // FIXME: ask jseyfried why the qpath.def for `use std::cmp::Ordering::*;` // extracted through `ItemUse(ref qpath, UseKind::Glob)` is a `Mod` and not an `Enum` - if let Def::Enum(_) = path.def { + //if let Def::Enum(_) = path.def { + if path.segments.last().and_then(|seg| seg.name.as_str().chars().next()).map_or(false, char::is_uppercase) { span_lint(cx, ENUM_GLOB_USE, item.span, "don't use glob imports for enum variants"); } }