From 6996ec860bde7e6186ba8609b68ef51b8713e2ea Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 23 Jun 2020 18:17:43 +0200 Subject: Drop rarely used fixture functionality --- crates/ra_db/src/fixture.rs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'crates/ra_db/src') 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 let crate_graph = if let Some(entry) = fixture { let meta = match ParsedMeta::from(&entry.meta) { ParsedMeta::File(it) => it, - _ => panic!("with_single_file only support file meta"), }; let mut crate_graph = CrateGraph::default(); @@ -159,21 +158,14 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option = None; let mut file_set = FileSet::default(); - let mut source_root_id = WORKSPACE; - let mut source_root_prefix = "/".to_string(); + let source_root_id = WORKSPACE; + let source_root_prefix = "/".to_string(); let mut file_id = FileId(0); let mut file_position = None; for entry in fixture.iter() { let meta = match ParsedMeta::from(&entry.meta) { - ParsedMeta::Root { path } => { - let file_set = std::mem::replace(&mut file_set, FileSet::default()); - db.set_source_root(source_root_id, Arc::new(SourceRoot::new_local(file_set))); - source_root_id.0 += 1; - source_root_prefix = path; - continue; - } ParsedMeta::File(it) => it, }; assert!(meta.path.starts_with(&source_root_prefix)); @@ -239,7 +231,6 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option for ParsedMeta { fn from(meta: &FixtureMeta) -> Self { match meta { - FixtureMeta::Root { path } => { - // `Self::Root` causes a false warning: 'variant is never constructed: `Root` ' - // see https://github.com/rust-lang/rust/issues/69018 - ParsedMeta::Root { path: path.to_owned() } - } FixtureMeta::File(f) => Self::File(FileMeta { path: f.path.to_owned(), krate: f.crate_name.to_owned(), -- cgit v1.2.3