diff options
Diffstat (limited to 'crates/ra_hir/src/nameres/mod_resolution.rs')
-rw-r--r-- | crates/ra_hir/src/nameres/mod_resolution.rs | 13 |
1 files changed, 3 insertions, 10 deletions
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 { | |||
30 | None => path.push(&name.to_string()), | 30 | None => path.push(&name.to_string()), |
31 | Some(attr_path) => { | 31 | Some(attr_path) => { |
32 | if self.root_non_dir_owner { | 32 | if self.root_non_dir_owner { |
33 | // Workaround for relative path API: turn `lib.rs` into ``. | 33 | assert!(path.pop()); |
34 | if !path.pop() { | ||
35 | path = RelativePathBuf::default(); | ||
36 | } | ||
37 | } | 34 | } |
38 | path.push(attr_path); | 35 | path.push(attr_path); |
39 | } | 36 | } |
@@ -48,17 +45,13 @@ impl ModDir { | |||
48 | name: &Name, | 45 | name: &Name, |
49 | attr_path: Option<&SmolStr>, | 46 | attr_path: Option<&SmolStr>, |
50 | ) -> Result<(FileId, ModDir), RelativePathBuf> { | 47 | ) -> Result<(FileId, ModDir), RelativePathBuf> { |
51 | let empty_path = RelativePathBuf::default(); | ||
52 | let file_id = file_id.original_file(db); | 48 | let file_id = file_id.original_file(db); |
53 | 49 | ||
54 | let mut candidate_files = Vec::new(); | 50 | let mut candidate_files = Vec::new(); |
55 | match attr_to_path(attr_path) { | 51 | match attr_to_path(attr_path) { |
56 | Some(attr_path) => { | 52 | Some(attr_path) => { |
57 | let base = if self.root_non_dir_owner { | 53 | let base = |
58 | self.path.parent().unwrap_or(&empty_path) | 54 | if self.root_non_dir_owner { self.path.parent().unwrap() } else { &self.path }; |
59 | } else { | ||
60 | &self.path | ||
61 | }; | ||
62 | candidate_files.push(base.join(attr_path)) | 55 | candidate_files.push(base.join(attr_path)) |
63 | } | 56 | } |
64 | None => { | 57 | None => { |