Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/extract_module.rs')
| -rw-r--r-- | crates/ide-assists/src/handlers/extract_module.rs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/crates/ide-assists/src/handlers/extract_module.rs b/crates/ide-assists/src/handlers/extract_module.rs index 3bc13bde26..30c3983dc4 100644 --- a/crates/ide-assists/src/handlers/extract_module.rs +++ b/crates/ide-assists/src/handlers/extract_module.rs @@ -689,27 +689,22 @@ fn does_source_exists_outside_sel_in_same_mod( match def { Definition::Module(x) => { let source = x.definition_source(ctx.db()); - let have_same_parent; - if let Some(ast_module) = &curr_parent_module { + let have_same_parent = if let Some(ast_module) = &curr_parent_module { if let Some(hir_module) = x.parent(ctx.db()) { - have_same_parent = - compare_hir_and_ast_module(ast_module, hir_module, ctx).is_some(); + compare_hir_and_ast_module(ast_module, hir_module, ctx).is_some() } else { let source_file_id = source.file_id.original_file(ctx.db()); - have_same_parent = source_file_id == curr_file_id; + source_file_id == curr_file_id } } else { let source_file_id = source.file_id.original_file(ctx.db()); - have_same_parent = source_file_id == curr_file_id; - } + source_file_id == curr_file_id + }; if have_same_parent { - match source.value { - ModuleSource::Module(module_) => { - source_exists_outside_sel_in_same_mod = - !selection_range.contains_range(module_.syntax().text_range()); - } - _ => {} + if let ModuleSource::Module(module_) = source.value { + source_exists_outside_sel_in_same_mod = + !selection_range.contains_range(module_.syntax().text_range()); } } } |