From e63c00f100e960f7b72997026b4b2cd3cd29774b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 5 Jun 2020 14:55:23 +0200 Subject: Rename resolve_relative_path -> resolve_path For things like `concant!(env!("OUT_DIR"))`, we need to support abs paths --- crates/ra_hir_def/src/nameres/mod_resolution.rs | 2 +- crates/ra_hir_def/src/test_db.rs | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/nameres/mod_resolution.rs b/crates/ra_hir_def/src/nameres/mod_resolution.rs index 386c5cade..7af922c21 100644 --- a/crates/ra_hir_def/src/nameres/mod_resolution.rs +++ b/crates/ra_hir_def/src/nameres/mod_resolution.rs @@ -61,7 +61,7 @@ impl ModDir { }; for candidate in candidate_files.iter() { - if let Some(file_id) = db.resolve_relative_path(file_id, candidate) { + if let Some(file_id) = db.resolve_path(file_id, candidate) { let mut root_non_dir_owner = false; let mut mod_path = RelativePathBuf::new(); if !(candidate.ends_with("mod.rs") || attr_path.is_some()) { diff --git a/crates/ra_hir_def/src/test_db.rs b/crates/ra_hir_def/src/test_db.rs index eb83dee79..d33b57c93 100644 --- a/crates/ra_hir_def/src/test_db.rs +++ b/crates/ra_hir_def/src/test_db.rs @@ -58,12 +58,8 @@ impl FileLoader for TestDB { fn file_text(&self, file_id: FileId) -> Arc { FileLoaderDelegate(self).file_text(file_id) } - fn resolve_relative_path( - &self, - anchor: FileId, - relative_path: &RelativePath, - ) -> Option { - FileLoaderDelegate(self).resolve_relative_path(anchor, relative_path) + fn resolve_path(&self, anchor: FileId, relative_path: &RelativePath) -> Option { + FileLoaderDelegate(self).resolve_path(anchor, relative_path) } fn relevant_crates(&self, file_id: FileId) -> Arc> { FileLoaderDelegate(self).relevant_crates(file_id) -- cgit v1.2.3 From bba374bab2ee53643a899e7ea459b4ab27663bd0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 5 Jun 2020 15:07:30 +0200 Subject: More direct signature for resolve_path --- crates/ra_hir_def/src/nameres/mod_resolution.rs | 2 +- crates/ra_hir_def/src/test_db.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/nameres/mod_resolution.rs b/crates/ra_hir_def/src/nameres/mod_resolution.rs index 7af922c21..cede4a6fc 100644 --- a/crates/ra_hir_def/src/nameres/mod_resolution.rs +++ b/crates/ra_hir_def/src/nameres/mod_resolution.rs @@ -61,7 +61,7 @@ impl ModDir { }; for candidate in candidate_files.iter() { - if let Some(file_id) = db.resolve_path(file_id, candidate) { + if let Some(file_id) = db.resolve_path(file_id, candidate.as_str()) { let mut root_non_dir_owner = false; let mut mod_path = RelativePathBuf::new(); if !(candidate.ends_with("mod.rs") || attr_path.is_some()) { diff --git a/crates/ra_hir_def/src/test_db.rs b/crates/ra_hir_def/src/test_db.rs index d33b57c93..e7a5182f0 100644 --- a/crates/ra_hir_def/src/test_db.rs +++ b/crates/ra_hir_def/src/test_db.rs @@ -58,8 +58,8 @@ impl FileLoader for TestDB { fn file_text(&self, file_id: FileId) -> Arc { FileLoaderDelegate(self).file_text(file_id) } - fn resolve_path(&self, anchor: FileId, relative_path: &RelativePath) -> Option { - FileLoaderDelegate(self).resolve_path(anchor, relative_path) + fn resolve_path(&self, anchor: FileId, path: &str) -> Option { + FileLoaderDelegate(self).resolve_path(anchor, path) } fn relevant_crates(&self, file_id: FileId) -> Arc> { FileLoaderDelegate(self).relevant_crates(file_id) -- cgit v1.2.3