From dea1a69e1cb0af7d6917d351a811ef205b7dfef9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Dec 2018 17:23:49 +0300 Subject: remove relpath from input --- crates/ra_db/src/mock.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 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 2f7551597..14d9e79b5 100644 --- a/crates/ra_db/src/mock.rs +++ b/crates/ra_db/src/mock.rs @@ -1,9 +1,7 @@ -use std::sync::Arc; - use rustc_hash::FxHashSet; use relative_path::{RelativePath, RelativePathBuf}; -use crate::{FileId, FileResolver, SourceRoot, FileResolverImp}; +use crate::{FileId, FileResolver, SourceRoot}; #[derive(Default, Debug, Clone)] pub struct FileMap(Vec<(FileId, RelativePathBuf)>); @@ -17,11 +15,7 @@ impl FileMap { pub fn into_source_root(self) -> SourceRoot { let files = self.files(); - let file_resolver = FileResolverImp::new(Arc::new(self)); - SourceRoot { - file_resolver, - files, - } + SourceRoot { files } } pub fn files(&self) -> FxHashSet { -- cgit v1.2.3 From 85290bc1342560d5560f0b2151cff1c0c6dac155 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 19 Dec 2018 12:20:54 +0300 Subject: switch analysis to vfs --- crates/ra_db/src/mock.rs | 7 +------ 1 file changed, 1 insertion(+), 6 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 14d9e79b5..efe987bdd 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, SourceRoot}; +use crate::{FileId, FileResolver}; #[derive(Default, Debug, Clone)] pub struct FileMap(Vec<(FileId, RelativePathBuf)>); @@ -13,11 +13,6 @@ impl FileMap { file_id } - pub fn into_source_root(self) -> SourceRoot { - let files = self.files(); - SourceRoot { files } - } - pub fn files(&self) -> FxHashSet { self.iter().map(|(id, _)| id).collect() } -- cgit v1.2.3 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