aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-27 09:40:57 +0000
committerGitHub <[email protected]>2019-10-27 09:40:57 +0000
commit7dfbe28211910d5d7c74a593bf0007c5db3e3496 (patch)
tree85231799bdc84bcd43ceceee08fe7714a9f21faa /crates/ra_hir/src
parent5a3d2332f8d5e382fc06210c260ff6db857ac716 (diff)
parent8464c45086ee0f5e40a4c9e5e4a76cdfeb3a1ad2 (diff)
Merge #2087
2087: remove relative_path_buf workaround r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/nameres/mod_resolution.rs13
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 => {