diff options
author | Aleksey Kladov <[email protected]> | 2020-06-23 17:34:50 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-23 17:37:26 +0100 |
commit | 21f751a0e5da5dd488612e25abfc545c259050e7 (patch) | |
tree | 0ad1b22fcc5b26456ecc92f473fb2306922fd6aa /crates/ra_ide | |
parent | 30748161f0b4699ba9bc699a38ac9fc2fae49461 (diff) |
Simplify
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/mock_analysis.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs index c0840c6ea..d480fcf62 100644 --- a/crates/ra_ide/src/mock_analysis.rs +++ b/crates/ra_ide/src/mock_analysis.rs | |||
@@ -25,7 +25,7 @@ impl MockFileData { | |||
25 | fn path(&self) -> &str { | 25 | fn path(&self) -> &str { |
26 | match self { | 26 | match self { |
27 | MockFileData::Plain { path, .. } => path.as_str(), | 27 | MockFileData::Plain { path, .. } => path.as_str(), |
28 | MockFileData::Fixture(f) => f.meta.path.as_str(), | 28 | MockFileData::Fixture(f) => f.path.as_str(), |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
@@ -38,25 +38,23 @@ impl MockFileData { | |||
38 | 38 | ||
39 | fn cfg_options(&self) -> CfgOptions { | 39 | fn cfg_options(&self) -> CfgOptions { |
40 | match self { | 40 | match self { |
41 | MockFileData::Fixture(f) => f.meta.cfg.clone(), | 41 | MockFileData::Fixture(f) => f.cfg.clone(), |
42 | _ => CfgOptions::default(), | 42 | _ => CfgOptions::default(), |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | fn edition(&self) -> Edition { | 46 | fn edition(&self) -> Edition { |
47 | match self { | 47 | match self { |
48 | MockFileData::Fixture(f) => f | 48 | MockFileData::Fixture(f) => { |
49 | .meta | 49 | f.edition.as_ref().map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()) |
50 | .edition | 50 | } |
51 | .as_ref() | ||
52 | .map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()), | ||
53 | _ => Edition::Edition2018, | 51 | _ => Edition::Edition2018, |
54 | } | 52 | } |
55 | } | 53 | } |
56 | 54 | ||
57 | fn env(&self) -> Env { | 55 | fn env(&self) -> Env { |
58 | match self { | 56 | match self { |
59 | MockFileData::Fixture(f) => Env::from(f.meta.env.iter()), | 57 | MockFileData::Fixture(f) => Env::from(f.env.iter()), |
60 | _ => Env::default(), | 58 | _ => Env::default(), |
61 | } | 59 | } |
62 | } | 60 | } |