From 8464c45086ee0f5e40a4c9e5e4a76cdfeb3a1ad2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 27 Oct 2019 12:36:40 +0300 Subject: remove relative_path_buf workaround The upstream problem was fixed with the change to 1.0 --- crates/ra_hir/src/nameres/mod_resolution.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/nameres/mod_resolution.rs b/crates/ra_hir/src/nameres/mod_resolution.rs index e8b808514..334cdd692 100644 --- a/crates/ra_hir/src/nameres/mod_resolution.rs +++ b/crates/ra_hir/src/nameres/mod_resolution.rs @@ -30,10 +30,7 @@ impl ModDir { None => path.push(&name.to_string()), Some(attr_path) => { if self.root_non_dir_owner { - // Workaround for relative path API: turn `lib.rs` into ``. - if !path.pop() { - path = RelativePathBuf::default(); - } + assert!(path.pop()); } path.push(attr_path); } @@ -48,17 +45,13 @@ impl ModDir { name: &Name, attr_path: Option<&SmolStr>, ) -> Result<(FileId, ModDir), RelativePathBuf> { - let empty_path = RelativePathBuf::default(); let file_id = file_id.original_file(db); let mut candidate_files = Vec::new(); match attr_to_path(attr_path) { Some(attr_path) => { - let base = if self.root_non_dir_owner { - self.path.parent().unwrap_or(&empty_path) - } else { - &self.path - }; + let base = + if self.root_non_dir_owner { self.path.parent().unwrap() } else { &self.path }; candidate_files.push(base.join(attr_path)) } None => { -- cgit v1.2.3