From 9863798480aa9642e31bfd41ee899d2e7329b5e5 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 10 Sep 2020 01:45:49 +0300 Subject: Rename the method to avoid false promises --- crates/ide/src/completion/complete_mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ide/src') diff --git a/crates/ide/src/completion/complete_mod.rs b/crates/ide/src/completion/complete_mod.rs index d457ff6bf..2ea0d5034 100644 --- a/crates/ide/src/completion/complete_mod.rs +++ b/crates/ide/src/completion/complete_mod.rs @@ -52,11 +52,11 @@ pub(super) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Op .filter_map(|submodule_file| { let submodule_path = source_root.path_for_file(&submodule_file)?; let directory_with_submodule = submodule_path.parent()?; - match submodule_path.file_name_and_extension()? { + match submodule_path.name_and_extension()? { ("lib", Some("rs")) | ("main", Some("rs")) => None, ("mod", Some("rs")) => { if directory_with_submodule.parent()? == directory_to_look_for_submodules { - match directory_with_submodule.file_name_and_extension()? { + match directory_with_submodule.name_and_extension()? { (directory_name, None) => Some(directory_name.to_owned()), _ => None, } @@ -93,7 +93,7 @@ fn directory_to_look_for_submodules( module_file_path: &VfsPath, ) -> Option { let directory_with_module_path = module_file_path.parent()?; - let base_directory = match module_file_path.file_name_and_extension()? { + let base_directory = match module_file_path.name_and_extension()? { ("mod", Some("rs")) | ("lib", Some("rs")) | ("main", Some("rs")) => { Some(directory_with_module_path) } @@ -103,8 +103,8 @@ fn directory_to_look_for_submodules( directory_with_module_path .parent() .as_ref() - .and_then(|path| path.file_name_and_extension()), - directory_with_module_path.file_name_and_extension(), + .and_then(|path| path.name_and_extension()), + directory_with_module_path.name_and_extension(), ), (Some(("src", None)), Some(("bin", None))) ) { -- cgit v1.2.3