1
1
//! lint on `use`ing all variants of an enum
2
2
3
3
use rustc:: hir:: * ;
4
+ use rustc:: hir:: def:: Def ;
4
5
use rustc:: lint:: { LateContext , LateLintPass , LintArray , LintPass } ;
5
6
use syntax:: ast:: NodeId ;
6
7
use syntax:: codemap:: Span ;
@@ -12,8 +13,7 @@ use utils::span_lint;
12
13
/// an enumeration variant, rather than importing variants.
13
14
///
14
15
/// **Known problems:** Old-style enumerations that prefix the variants are
15
- /// still around. May cause problems with modules that are not snake_case (see
16
- /// [#2397](https://github.com/rust-lang-nursery/rust-clippy/issues/2397))
16
+ /// still around.
17
17
///
18
18
/// **Example:**
19
19
/// ```rust
@@ -48,16 +48,13 @@ impl EnumGlobUse {
48
48
return ; // re-exports are fine
49
49
}
50
50
if let ItemUse ( ref path, UseKind :: Glob ) = item. node {
51
- // FIXME: ask jseyfried why the qpath.def for `use std::cmp::Ordering::*;`
52
- // extracted through `ItemUse(ref qpath, UseKind::Glob)` is a `Mod` and not an
53
- // `Enum`
54
- // if let Def::Enum(_) = path.def {
55
- if path. segments
56
- . last ( )
57
- . and_then ( |seg| seg. name . as_str ( ) . chars ( ) . next ( ) )
58
- . map_or ( false , char:: is_uppercase)
59
- {
60
- span_lint ( cx, ENUM_GLOB_USE , item. span , "don't use glob imports for enum variants" ) ;
51
+ if let Def :: Enum ( _) = path. def {
52
+ span_lint (
53
+ cx,
54
+ ENUM_GLOB_USE ,
55
+ item. span ,
56
+ "don't use glob imports for enum variants" ,
57
+ ) ;
61
58
}
62
59
}
63
60
}
0 commit comments