Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 068b138

Browse files
committed
Remove unecessary unwrap
1 parent aef1630 commit 068b138

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,12 @@ fn relevance_score(ctx: &AssistContext, import: &LocatedImport) -> i32 {
189189
}
190190
}
191191

192-
match item_module.zip(current_node) {
192+
let current_scope = current_node.as_ref().and_then(|node| ctx.sema.scope(node));
193+
194+
match item_module.zip(current_scope) {
193195
// get the distance between the modules (prefer items that are more local)
194-
Some((item_module, current_node)) => {
195-
let current_module = ctx.sema.scope(&current_node).unwrap().module();
196+
Some((item_module, current_scope)) => {
197+
let current_module = current_scope.module();
196198
score -= module_distance_hueristic(&current_module, &item_module, db) as i32;
197199
}
198200

0 commit comments

Comments
 (0)