Remove unecessary unwrap

This commit is contained in:
Christofer Nolander 2022-05-21 10:25:12 +02:00
parent aef16300f7
commit 068b138c87

View File

@ -189,10 +189,12 @@ fn relevance_score(ctx: &AssistContext, import: &LocatedImport) -> i32 {
} }
} }
match item_module.zip(current_node) { let current_scope = current_node.as_ref().and_then(|node| ctx.sema.scope(node));
match item_module.zip(current_scope) {
// get the distance between the modules (prefer items that are more local) // get the distance between the modules (prefer items that are more local)
Some((item_module, current_node)) => { Some((item_module, current_scope)) => {
let current_module = ctx.sema.scope(&current_node).unwrap().module(); let current_module = current_scope.module();
score -= module_distance_hueristic(&current_module, &item_module, db) as i32; score -= module_distance_hueristic(&current_module, &item_module, db) as i32;
} }