Skip to content

Commit f5403ae

Browse files
author
Jonas Schievink
committed
simplify
1 parent 5620d25 commit f5403ae

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

crates/ide_assists/src/handlers/expand_glob_import.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub(crate) fn expand_glob_import(acc: &mut Assists, ctx: &AssistContext) -> Opti
5252
let current_scope = ctx.sema.scope(&star.parent()?)?;
5353
let current_module = current_scope.module();
5454

55-
let refs_in_target = find_refs_in_mod(ctx, target_module, Some(current_module))?;
55+
let refs_in_target = find_refs_in_mod(ctx, target_module, current_module)?;
5656
let imported_defs = find_imported_defs(ctx, star)?;
5757

5858
let target = parent.either(|n| n.syntax().clone(), |n| n.syntax().clone());
@@ -168,18 +168,12 @@ impl Refs {
168168
}
169169
}
170170

171-
fn find_refs_in_mod(
172-
ctx: &AssistContext,
173-
module: Module,
174-
visible_from: Option<Module>,
175-
) -> Option<Refs> {
176-
if let Some(from) = visible_from {
177-
if !is_mod_visible_from(ctx, module, from) {
178-
return None;
179-
}
171+
fn find_refs_in_mod(ctx: &AssistContext, module: Module, visible_from: Module) -> Option<Refs> {
172+
if !is_mod_visible_from(ctx, module, visible_from) {
173+
return None;
180174
}
181175

182-
let module_scope = module.scope(ctx.db(), visible_from);
176+
let module_scope = module.scope(ctx.db(), Some(visible_from));
183177
let refs = module_scope.into_iter().filter_map(|(n, d)| Ref::from_scope_def(n, d)).collect();
184178
Some(Refs(refs))
185179
}

0 commit comments

Comments
 (0)