Make edition handling a bit nicer and allow specifying edition in crate_graph macro

This commit is contained in:
Florian Diebold 2019-02-13 20:31:27 +01:00
parent d5ad38cbb8
commit 70839b7ef8
5 changed files with 28 additions and 25 deletions

View file

@ -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,