diff options
-rw-r--r-- | crates/ra_db/src/input.rs | 12 | ||||
-rw-r--r-- | crates/ra_db/src/lib.rs | 2 |
2 files changed, 5 insertions, 9 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 4d2d3b48a..a8d6466ea 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -337,15 +337,11 @@ impl Env { | |||
337 | } | 337 | } |
338 | 338 | ||
339 | impl ExternSource { | 339 | impl ExternSource { |
340 | pub fn extern_path(&self, path: impl AsRef<Path>) -> Option<(ExternSourceId, RelativePathBuf)> { | 340 | pub fn extern_path(&self, path: &Path) -> Option<(ExternSourceId, RelativePathBuf)> { |
341 | let path = path.as_ref(); | ||
342 | self.extern_paths.iter().find_map(|(root_path, id)| { | 341 | self.extern_paths.iter().find_map(|(root_path, id)| { |
343 | if let Ok(rel_path) = path.strip_prefix(root_path) { | 342 | let rel_path = path.strip_prefix(root_path).ok()?; |
344 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; | 343 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; |
345 | Some((*id, rel_path)) | 344 | Some((*id, rel_path)) |
346 | } else { | ||
347 | None | ||
348 | } | ||
349 | }) | 345 | }) |
350 | } | 346 | } |
351 | 347 | ||
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 91e0ee619..2ab314884 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -158,7 +158,7 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> { | |||
158 | if std::path::Path::new(path).is_absolute() { | 158 | if std::path::Path::new(path).is_absolute() { |
159 | let krate = *self.relevant_crates(anchor).get(0)?; | 159 | let krate = *self.relevant_crates(anchor).get(0)?; |
160 | let (extern_source_id, relative_file) = | 160 | let (extern_source_id, relative_file) = |
161 | self.0.crate_graph()[krate].extern_source.extern_path(path)?; | 161 | self.0.crate_graph()[krate].extern_source.extern_path(path.as_ref())?; |
162 | 162 | ||
163 | let source_root = self.0.source_root(SourceRootId(extern_source_id.0)); | 163 | let source_root = self.0.source_root(SourceRootId(extern_source_id.0)); |
164 | source_root.file_by_relative_path(&relative_file) | 164 | source_root.file_by_relative_path(&relative_file) |