Skip to content

Commit 55dd211

Browse files
committed
check glob
Signed-off-by: Hayashi Mikihiro <[email protected]>
1 parent bf13549 commit 55dd211

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

crates/ide-assists/src/handlers/remove_unused_imports.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,28 +86,29 @@ pub(crate) fn remove_unused_imports(acc: &mut Assists, ctx: &AssistContext<'_>)
8686
return None;
8787
}
8888
};
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;
110109
}
110+
}
111+
match res {
111112
PathResolutionPerNs {
112113
type_ns: Some(PathResolution::Def(ModuleDef::Trait(ref t))),
113114
value_ns,

0 commit comments

Comments
 (0)