From 70839b7ef8217fd019ce5bd3a643a8a16f5fa829 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 13 Feb 2019 20:31:27 +0100 Subject: Make edition handling a bit nicer and allow specifying edition in crate_graph macro --- crates/ra_db/src/input.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/ra_db') 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 { Edition2015, } +impl Edition { + pub fn from_string(s: &str) -> Edition { + match s { + "2015" => Edition::Edition2015, + "2018" | _ => Edition::Edition2018, + } + } +} + #[derive(Debug, Clone, PartialEq, Eq)] struct CrateData { file_id: FileId, -- cgit v1.2.3