aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-23 17:20:32 +0100
committerAleksey Kladov <[email protected]>2020-06-23 17:37:26 +0100
commit30748161f0b4699ba9bc699a38ac9fc2fae49461 (patch)
treeeaa4c2ab2076ce6bb2b641edaaa971787aec1d69 /crates/ra_ide
parent6996ec860bde7e6186ba8609b68ef51b8713e2ea (diff)
Simplify
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/mock_analysis.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index 58fafecab..c0840c6ea 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(), 28 MockFileData::Fixture(f) => f.meta.path.as_str(),
29 } 29 }
30 } 30 }
31 31
@@ -38,25 +38,25 @@ 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) => { 41 MockFileData::Fixture(f) => f.meta.cfg.clone(),
42 f.meta.cfg_options().map_or_else(Default::default, |o| o.clone())
43 }
44 _ => CfgOptions::default(), 42 _ => CfgOptions::default(),
45 } 43 }
46 } 44 }
47 45
48 fn edition(&self) -> Edition { 46 fn edition(&self) -> Edition {
49 match self { 47 match self {
50 MockFileData::Fixture(f) => { 48 MockFileData::Fixture(f) => f
51 f.meta.edition().map_or(Edition::Edition2018, |v| Edition::from_str(v).unwrap()) 49 .meta
52 } 50 .edition
51 .as_ref()
52 .map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()),
53 _ => Edition::Edition2018, 53 _ => Edition::Edition2018,
54 } 54 }
55 } 55 }
56 56
57 fn env(&self) -> Env { 57 fn env(&self) -> Env {
58 match self { 58 match self {
59 MockFileData::Fixture(f) => Env::from(f.meta.env()), 59 MockFileData::Fixture(f) => Env::from(f.meta.env.iter()),
60 _ => Env::default(), 60 _ => Env::default(),
61 } 61 }
62 } 62 }