aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-23 17:34:50 +0100
committerAleksey Kladov <[email protected]>2020-06-23 17:37:26 +0100
commit21f751a0e5da5dd488612e25abfc545c259050e7 (patch)
tree0ad1b22fcc5b26456ecc92f473fb2306922fd6aa /crates/ra_db
parent30748161f0b4699ba9bc699a38ac9fc2fae49461 (diff)
Simplify
Diffstat (limited to 'crates/ra_db')
-rw-r--r--crates/ra_db/src/fixture.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs
index 7f006487a..d65536bbc 100644
--- a/crates/ra_db/src/fixture.rs
+++ b/crates/ra_db/src/fixture.rs
@@ -61,7 +61,9 @@ use std::{str::FromStr, sync::Arc};
61 61
62use ra_cfg::CfgOptions; 62use ra_cfg::CfgOptions;
63use rustc_hash::FxHashMap; 63use rustc_hash::FxHashMap;
64use test_utils::{extract_offset, parse_fixture, parse_single_fixture, CURSOR_MARKER}; 64use test_utils::{
65 extract_offset, parse_fixture, parse_single_fixture, FixtureEntry, CURSOR_MARKER,
66};
65use vfs::{file_set::FileSet, VfsPath}; 67use vfs::{file_set::FileSet, VfsPath};
66 68
67use crate::{ 69use crate::{
@@ -112,7 +114,7 @@ fn with_single_file(db: &mut dyn SourceDatabaseExt, ra_fixture: &str) -> FileId
112 let fixture = parse_single_fixture(ra_fixture); 114 let fixture = parse_single_fixture(ra_fixture);
113 115
114 let crate_graph = if let Some(entry) = fixture { 116 let crate_graph = if let Some(entry) = fixture {
115 let meta = match ParsedMeta::from(&entry.meta) { 117 let meta = match ParsedMeta::from(&entry) {
116 ParsedMeta::File(it) => it, 118 ParsedMeta::File(it) => it,
117 }; 119 };
118 120
@@ -165,7 +167,7 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit
165 let mut file_position = None; 167 let mut file_position = None;
166 168
167 for entry in fixture.iter() { 169 for entry in fixture.iter() {
168 let meta = match ParsedMeta::from(&entry.meta) { 170 let meta = match ParsedMeta::from(entry) {
169 ParsedMeta::File(it) => it, 171 ParsedMeta::File(it) => it,
170 }; 172 };
171 assert!(meta.path.starts_with(&source_root_prefix)); 173 assert!(meta.path.starts_with(&source_root_prefix));
@@ -243,8 +245,8 @@ struct FileMeta {
243 env: Env, 245 env: Env,
244} 246}
245 247
246impl From<&test_utils::FileMeta> for ParsedMeta { 248impl From<&FixtureEntry> for ParsedMeta {
247 fn from(f: &test_utils::FileMeta) -> Self { 249 fn from(f: &FixtureEntry) -> Self {
248 Self::File(FileMeta { 250 Self::File(FileMeta {
249 path: f.path.to_owned(), 251 path: f.path.to_owned(),
250 krate: f.crate_name.to_owned(), 252 krate: f.crate_name.to_owned(),