Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide_completion/src/completions/vis.rs')
-rw-r--r--crates/ide_completion/src/completions/vis.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/crates/ide_completion/src/completions/vis.rs b/crates/ide_completion/src/completions/vis.rs
index c610dcd705..ca6f6dff1e 100644
--- a/crates/ide_completion/src/completions/vis.rs
+++ b/crates/ide_completion/src/completions/vis.rs
@@ -22,17 +22,16 @@ pub(crate) fn complete_vis(acc: &mut Completions, ctx: &CompletionContext) {
Some(PathQualifierCtx { resolution, is_super_chain, .. }) => {
// Try completing next child module of the path that is still a parent of the current module
if let Some(hir::PathResolution::Def(hir::ModuleDef::Module(module))) = resolution {
- if let Some(current_module) = ctx.module {
- let next_towards_current = current_module
- .path_to_root(ctx.db)
- .into_iter()
- .take_while(|it| it != module)
- .last();
- if let Some(next) = next_towards_current {
- if let Some(name) = next.name(ctx.db) {
- cov_mark::hit!(visibility_qualified);
- acc.add_resolution(ctx, name, ScopeDef::ModuleDef(next.into()));
- }
+ let next_towards_current = ctx
+ .module
+ .path_to_root(ctx.db)
+ .into_iter()
+ .take_while(|it| it != module)
+ .last();
+ if let Some(next) = next_towards_current {
+ if let Some(name) = next.name(ctx.db) {
+ cov_mark::hit!(visibility_qualified);
+ acc.add_resolution(ctx, name, ScopeDef::ModuleDef(next.into()));
}
}
}