@@ -86,28 +86,29 @@ pub(crate) fn remove_unused_imports(acc: &mut Assists, ctx: &AssistContext<'_>)
86
86
return None ;
87
87
}
88
88
} ;
89
- match res {
90
- PathResolutionPerNs { type_ns : Some ( type_ns) , .. } if u. star_token ( ) . is_some ( ) => {
91
- // Check if any of the children of this module are used
92
- let def_mod = match type_ns {
93
- PathResolution :: Def ( ModuleDef :: Module ( module) ) => module,
94
- _ => return None ,
95
- } ;
96
-
97
- if !def_mod
98
- . scope ( ctx. db ( ) , Some ( use_module) )
99
- . iter ( )
100
- . filter_map ( |( _, x) | match x {
101
- hir:: ScopeDef :: ModuleDef ( d) => Some ( Definition :: from ( * d) ) ,
102
- _ => None ,
103
- } )
104
- . any ( |d| used_once_in_scope ( ctx, d, u. rename ( ) , scope) )
105
- {
106
- Some ( u)
107
- } else {
108
- None
109
- }
89
+
90
+ if u. star_token ( ) . is_some ( ) {
91
+ // Check if any of the children of this module are used
92
+ let def_mod = match res. type_ns {
93
+ Some ( PathResolution :: Def ( ModuleDef :: Module ( module) ) ) => module,
94
+ _ => return None ,
95
+ } ;
96
+
97
+ if !def_mod
98
+ . scope ( ctx. db ( ) , Some ( use_module) )
99
+ . iter ( )
100
+ . filter_map ( |( _, x) | match x {
101
+ hir:: ScopeDef :: ModuleDef ( d) => Some ( Definition :: from ( * d) ) ,
102
+ _ => None ,
103
+ } )
104
+ . any ( |d| used_once_in_scope ( ctx, d, u. rename ( ) , scope) )
105
+ {
106
+ return Some ( u) ;
107
+ } else {
108
+ return None ;
110
109
}
110
+ }
111
+ match res {
111
112
PathResolutionPerNs {
112
113
type_ns : Some ( PathResolution :: Def ( ModuleDef :: Trait ( ref t) ) ) ,
113
114
value_ns,
0 commit comments