diff options
author | Florian Diebold <[email protected]> | 2019-02-13 19:31:27 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-02-13 19:31:47 +0000 |
commit | 70839b7ef8217fd019ce5bd3a643a8a16f5fa829 (patch) | |
tree | d6888643048c0cf5738f4ddf756047ad138e500c /crates/ra_db | |
parent | d5ad38cbb87103d8713855e0ec705fd957249afd (diff) |
Make edition handling a bit nicer and allow specifying edition in crate_graph macro
Diffstat (limited to 'crates/ra_db')
-rw-r--r-- | crates/ra_db/src/input.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index aa535ac4d..e45a510b3 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -62,6 +62,15 @@ pub enum Edition { | |||
62 | Edition2015, | 62 | Edition2015, |
63 | } | 63 | } |
64 | 64 | ||
65 | impl Edition { | ||
66 | pub fn from_string(s: &str) -> Edition { | ||
67 | match s { | ||
68 | "2015" => Edition::Edition2015, | ||
69 | "2018" | _ => Edition::Edition2018, | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
65 | #[derive(Debug, Clone, PartialEq, Eq)] | 74 | #[derive(Debug, Clone, PartialEq, Eq)] |
66 | struct CrateData { | 75 | struct CrateData { |
67 | file_id: FileId, | 76 | file_id: FileId, |