Skip to content

Commit 256fb75

Browse files
committed
Remove temporary FixtureEntry parsed_meta field.
1 parent d901e0e commit 256fb75

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

crates/ra_db/src/fixture.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn with_single_file(db: &mut dyn SourceDatabaseExt, ra_fixture: &str) -> FileId
9999
let fixture = parse_single_fixture(ra_fixture);
100100

101101
let crate_graph = if let Some(entry) = fixture {
102-
let meta = match ParsedMeta::from(&entry.parsed_meta) {
102+
let meta = match ParsedMeta::from(&entry.meta) {
103103
ParsedMeta::File(it) => it,
104104
_ => panic!("with_single_file only support file meta"),
105105
};
@@ -156,7 +156,7 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit
156156
let mut file_position = None;
157157

158158
for entry in fixture.iter() {
159-
let meta = match ParsedMeta::from(&entry.parsed_meta) {
159+
let meta = match ParsedMeta::from(&entry.meta) {
160160
ParsedMeta::Root { path } => {
161161
let source_root = std::mem::replace(&mut source_root, SourceRoot::new_local());
162162
db.set_source_root(source_root_id, Arc::new(source_root));

crates/ra_ide/src/mock_analysis.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl MockAnalysis {
3535
pub fn with_files(fixture: &str) -> MockAnalysis {
3636
let mut res = MockAnalysis::new();
3737
for entry in parse_fixture(fixture) {
38-
res.add_file(&entry.meta, &entry.text);
38+
res.add_file(entry.meta.path().as_str(), &entry.text);
3939
}
4040
res
4141
}
@@ -48,9 +48,10 @@ impl MockAnalysis {
4848
for entry in parse_fixture(fixture) {
4949
if entry.text.contains(CURSOR_MARKER) {
5050
assert!(position.is_none(), "only one marker (<|>) per fixture is allowed");
51-
position = Some(res.add_file_with_position(&entry.meta, &entry.text));
51+
position =
52+
Some(res.add_file_with_position(&entry.meta.path().as_str(), &entry.text));
5253
} else {
53-
res.add_file(&entry.meta, &entry.text);
54+
res.add_file(&entry.meta.path().as_str(), &entry.text);
5455
}
5556
}
5657
let position = position.expect("expected a marker (<|>)");

crates/rust-analyzer/tests/heavy_tests/support.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a> Project<'a> {
6868
let mut paths = vec![];
6969

7070
for entry in parse_fixture(self.fixture) {
71-
let path = tmp_dir.path().join(entry.meta);
71+
let path = tmp_dir.path().join(entry.meta.path().as_str());
7272
fs::create_dir_all(path.parent().unwrap()).unwrap();
7373
fs::write(path.as_path(), entry.text.as_bytes()).unwrap();
7474
paths.push((path, entry.text));

crates/test_utils/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,8 @@ pub fn add_cursor(text: &str, offset: TextSize) -> String {
161161

162162
#[derive(Debug, Eq, PartialEq)]
163163
pub struct FixtureEntry {
164-
pub meta: String,
164+
pub meta: FixtureMeta,
165165
pub text: String,
166-
167-
pub parsed_meta: FixtureMeta,
168166
}
169167

170168
#[derive(Debug, Eq, PartialEq)]
@@ -231,8 +229,8 @@ The offending line: {:?}"#,
231229
for line in lines.by_ref() {
232230
if line.starts_with("//-") {
233231
let meta = line["//-".len()..].trim().to_string();
234-
let parsed_meta = parse_meta(&meta);
235-
res.push(FixtureEntry { meta, parsed_meta, text: String::new() })
232+
let meta = parse_meta(&meta);
233+
res.push(FixtureEntry { meta, text: String::new() })
236234
} else if let Some(entry) = res.last_mut() {
237235
entry.text.push_str(line);
238236
entry.text.push('\n');

0 commit comments

Comments
 (0)