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_project_model/src/cargo_workspace.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index e28aca259..81cb506b7 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -4,6 +4,7 @@ use cargo_metadata::{MetadataCommand, CargoOpt}; use ra_arena::{Arena, RawId, impl_arena_id}; use rustc_hash::FxHashMap; use failure::format_err; +use ra_db::Edition; use crate::Result; @@ -35,7 +36,7 @@ struct PackageData { targets: Vec, is_member: bool, dependencies: Vec, - edition: String, + edition: Edition, } #[derive(Debug, Clone)] @@ -85,8 +86,8 @@ impl Package { pub fn root(self, ws: &CargoWorkspace) -> &Path { ws.packages[self].manifest.parent().unwrap() } - pub fn edition(self, ws: &CargoWorkspace) -> &str { - &ws.packages[self].edition + pub fn edition(self, ws: &CargoWorkspace) -> Edition { + ws.packages[self].edition } pub fn targets<'a>(self, ws: &'a CargoWorkspace) -> impl Iterator + 'a { ws.packages[self].targets.iter().cloned() @@ -139,7 +140,7 @@ impl CargoWorkspace { manifest: meta_pkg.manifest_path.clone(), targets: Vec::new(), is_member, - edition: meta_pkg.edition, + edition: Edition::from_string(&meta_pkg.edition), dependencies: Vec::new(), }); let pkg_data = &mut packages[pkg]; -- cgit v1.2.3