aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-09 10:49:54 +0000
committerAleksey Kladov <[email protected]>2018-12-09 10:49:54 +0000
commit7784c7a701ba944decf671f80dea581d68667663 (patch)
tree548400065966f715ae203e6f6e0fcfd9f12e4470 /crates/ra_db/src
parente89da32bb7cf7388946964e1e34df722527d0838 (diff)
resolve extern crates propertly
Diffstat (limited to 'crates/ra_db/src')
-rw-r--r--crates/ra_db/src/mock.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_db/src/mock.rs b/crates/ra_db/src/mock.rs
index 2840f9655..2f7551597 100644
--- a/crates/ra_db/src/mock.rs
+++ b/crates/ra_db/src/mock.rs
@@ -5,7 +5,7 @@ use relative_path::{RelativePath, RelativePathBuf};
5 5
6use crate::{FileId, FileResolver, SourceRoot, FileResolverImp}; 6use crate::{FileId, FileResolver, SourceRoot, FileResolverImp};
7 7
8#[derive(Default, Debug)] 8#[derive(Default, Debug, Clone)]
9pub struct FileMap(Vec<(FileId, RelativePathBuf)>); 9pub struct FileMap(Vec<(FileId, RelativePathBuf)>);
10 10
11impl FileMap { 11impl FileMap {
@@ -28,6 +28,11 @@ impl FileMap {
28 self.iter().map(|(id, _)| id).collect() 28 self.iter().map(|(id, _)| id).collect()
29 } 29 }
30 30
31 pub fn file_id(&self, path: &str) -> FileId {
32 assert!(path.starts_with('/'));
33 self.iter().find(|(_, p)| p == &path[1..]).unwrap().0
34 }
35
31 fn iter<'a>(&'a self) -> impl Iterator<Item = (FileId, &'a RelativePath)> + 'a { 36 fn iter<'a>(&'a self) -> impl Iterator<Item = (FileId, &'a RelativePath)> + 'a {
32 self.0 37 self.0
33 .iter() 38 .iter()