@@ -35,26 +35,27 @@ impl LintPass for UnsafeNameRemoval {
35
35
36
36
impl EarlyLintPass for UnsafeNameRemoval {
37
37
fn check_item ( & mut self , cx : & EarlyContext , item : & Item ) {
38
- if let ItemKind :: Use ( ref item_use) = item. node {
39
- match item_use. node {
40
- ViewPath_ :: ViewPathSimple ( ref name, ref path) => {
41
- unsafe_to_safe_check (
42
- path. segments
43
- . last ( )
44
- . expect ( "use paths cannot be empty" )
45
- . identifier ,
46
- * name,
47
- cx,
48
- & item. span ,
49
- ) ;
50
- } ,
51
- ViewPath_ :: ViewPathList ( _, ref path_list_items) => for path_list_item in path_list_items. iter ( ) {
52
- let plid = path_list_item. node ;
53
- if let Some ( rename) = plid. rename {
54
- unsafe_to_safe_check ( plid. name , rename, cx, & item. span ) ;
55
- } ;
56
- } ,
57
- ViewPath_ :: ViewPathGlob ( _) => { } ,
38
+ if let ItemKind :: Use ( ref use_tree) = item. node {
39
+ check_use_tree ( use_tree, cx, & item. span ) ;
40
+ }
41
+ }
42
+ }
43
+
44
+ fn check_use_tree ( use_tree : & UseTree , cx : & EarlyContext , span : & Span ) {
45
+ match use_tree. kind {
46
+ UseTreeKind :: Simple ( new_name) => {
47
+ let old_name = use_tree
48
+ . prefix
49
+ . segments
50
+ . last ( )
51
+ . expect ( "use paths cannot be empty" )
52
+ . identifier ;
53
+ unsafe_to_safe_check ( old_name, new_name, cx, span) ;
54
+ }
55
+ UseTreeKind :: Glob => { } ,
56
+ UseTreeKind :: Nested ( ref nested_use_tree) => {
57
+ for & ( ref use_tree, _) in nested_use_tree {
58
+ check_use_tree ( use_tree, cx, span) ;
58
59
}
59
60
}
60
61
}
0 commit comments