move rename to a new mod

This commit is contained in:
gfreezy 2019-01-16 21:39:01 +08:00 committed by Aleksey Kladov
parent bc0f79f74a
commit 5c8cb56506
8 changed files with 233 additions and 105 deletions

View file

@ -35,14 +35,9 @@ pub fn module_from_declaration(
let parent_module = module_from_file_id(db, file_id);
let child_name = decl.name();
match (parent_module, child_name) {
(Some(parent_module), Some(child_name)) => {
if let Some(child) = parent_module.child(db, &child_name.as_name()) {
return Some(child);
}
}
_ => (),
(Some(parent_module), Some(child_name)) => parent_module.child(db, &child_name.as_name()),
_ => None,
}
None
}
/// Locates the module by position in the source code.