From 18aac1df45ca39d01d80a56e3afab7299de160f8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Dec 2018 12:26:51 +0300 Subject: kill file resolver --- crates/ra_db/src/mock.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'crates/ra_db/src/mock.rs') diff --git a/crates/ra_db/src/mock.rs b/crates/ra_db/src/mock.rs index efe987bdd..5e185062b 100644 --- a/crates/ra_db/src/mock.rs +++ b/crates/ra_db/src/mock.rs @@ -1,7 +1,7 @@ use rustc_hash::FxHashSet; use relative_path::{RelativePath, RelativePathBuf}; -use crate::{FileId, FileResolver}; +use crate::{FileId}; #[derive(Default, Debug, Clone)] pub struct FileMap(Vec<(FileId, RelativePathBuf)>); @@ -27,19 +27,4 @@ impl FileMap { .iter() .map(|(id, path)| (*id, path.as_relative_path())) } - - fn path(&self, id: FileId) -> &RelativePath { - self.iter().find(|&(it, _)| it == id).unwrap().1 - } -} - -impl FileResolver for FileMap { - fn file_stem(&self, id: FileId) -> String { - self.path(id).file_stem().unwrap().to_string() - } - fn resolve(&self, id: FileId, rel: &RelativePath) -> Option { - let path = self.path(id).join(rel).normalize(); - let id = self.iter().find(|&(_, p)| path == p)?.0; - Some(id) - } } -- cgit v1.2.3