diff options
author | Aleksey Kladov <[email protected]> | 2020-06-23 17:17:43 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-23 17:37:26 +0100 |
commit | 6996ec860bde7e6186ba8609b68ef51b8713e2ea (patch) | |
tree | 303a1db3e3652c66908701f1efca34ab27b9d5e9 /crates/ra_db | |
parent | f304874c8c12de6120663ffff7f1bfdc69f19496 (diff) |
Drop rarely used fixture functionality
Diffstat (limited to 'crates/ra_db')
-rw-r--r-- | crates/ra_db/src/fixture.rs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs index f7d9118a9..bf897baff 100644 --- a/crates/ra_db/src/fixture.rs +++ b/crates/ra_db/src/fixture.rs | |||
@@ -114,7 +114,6 @@ fn with_single_file(db: &mut dyn SourceDatabaseExt, ra_fixture: &str) -> FileId | |||
114 | let crate_graph = if let Some(entry) = fixture { | 114 | let crate_graph = if let Some(entry) = fixture { |
115 | let meta = match ParsedMeta::from(&entry.meta) { | 115 | let meta = match ParsedMeta::from(&entry.meta) { |
116 | ParsedMeta::File(it) => it, | 116 | ParsedMeta::File(it) => it, |
117 | _ => panic!("with_single_file only support file meta"), | ||
118 | }; | 117 | }; |
119 | 118 | ||
120 | let mut crate_graph = CrateGraph::default(); | 119 | let mut crate_graph = CrateGraph::default(); |
@@ -159,21 +158,14 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit | |||
159 | let mut default_crate_root: Option<FileId> = None; | 158 | let mut default_crate_root: Option<FileId> = None; |
160 | 159 | ||
161 | let mut file_set = FileSet::default(); | 160 | let mut file_set = FileSet::default(); |
162 | let mut source_root_id = WORKSPACE; | 161 | let source_root_id = WORKSPACE; |
163 | let mut source_root_prefix = "/".to_string(); | 162 | let source_root_prefix = "/".to_string(); |
164 | let mut file_id = FileId(0); | 163 | let mut file_id = FileId(0); |
165 | 164 | ||
166 | let mut file_position = None; | 165 | let mut file_position = None; |
167 | 166 | ||
168 | for entry in fixture.iter() { | 167 | for entry in fixture.iter() { |
169 | let meta = match ParsedMeta::from(&entry.meta) { | 168 | let meta = match ParsedMeta::from(&entry.meta) { |
170 | ParsedMeta::Root { path } => { | ||
171 | let file_set = std::mem::replace(&mut file_set, FileSet::default()); | ||
172 | db.set_source_root(source_root_id, Arc::new(SourceRoot::new_local(file_set))); | ||
173 | source_root_id.0 += 1; | ||
174 | source_root_prefix = path; | ||
175 | continue; | ||
176 | } | ||
177 | ParsedMeta::File(it) => it, | 169 | ParsedMeta::File(it) => it, |
178 | }; | 170 | }; |
179 | assert!(meta.path.starts_with(&source_root_prefix)); | 171 | assert!(meta.path.starts_with(&source_root_prefix)); |
@@ -239,7 +231,6 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit | |||
239 | } | 231 | } |
240 | 232 | ||
241 | enum ParsedMeta { | 233 | enum ParsedMeta { |
242 | Root { path: String }, | ||
243 | File(FileMeta), | 234 | File(FileMeta), |
244 | } | 235 | } |
245 | 236 | ||
@@ -255,11 +246,6 @@ struct FileMeta { | |||
255 | impl From<&FixtureMeta> for ParsedMeta { | 246 | impl From<&FixtureMeta> for ParsedMeta { |
256 | fn from(meta: &FixtureMeta) -> Self { | 247 | fn from(meta: &FixtureMeta) -> Self { |
257 | match meta { | 248 | match meta { |
258 | FixtureMeta::Root { path } => { | ||
259 | // `Self::Root` causes a false warning: 'variant is never constructed: `Root` ' | ||
260 | // see https://github.com/rust-lang/rust/issues/69018 | ||
261 | ParsedMeta::Root { path: path.to_owned() } | ||
262 | } | ||
263 | FixtureMeta::File(f) => Self::File(FileMeta { | 249 | FixtureMeta::File(f) => Self::File(FileMeta { |
264 | path: f.path.to_owned(), | 250 | path: f.path.to_owned(), |
265 | krate: f.crate_name.to_owned(), | 251 | krate: f.crate_name.to_owned(), |