aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model/src
diff options
context:
space:
mode:
authorMetabaron <[email protected]>2019-11-11 22:16:59 +0000
committerMetabaron <[email protected]>2019-11-12 11:01:13 +0000
commitb69738590ca1c4823a030d317e7fa6e918618a4b (patch)
tree802b7d860e22f74ea891517ea9ed5b68991adbc6 /crates/ra_project_model/src
parentf5e1b0f97c9e46b5186f99d744f4587b2aee397e (diff)
Implement FromStr for enum Edition
Diffstat (limited to 'crates/ra_project_model/src')
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 28dadea9d..ff96bf904 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -1,6 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use std::path::{Path, PathBuf}; 3use std::path::{Path, PathBuf};
4use std::str::FromStr;
4 5
5use cargo_metadata::{CargoOpt, MetadataCommand}; 6use cargo_metadata::{CargoOpt, MetadataCommand};
6use ra_arena::{impl_arena_id, Arena, RawId}; 7use ra_arena::{impl_arena_id, Arena, RawId};
@@ -141,12 +142,14 @@ impl CargoWorkspace {
141 142
142 for meta_pkg in meta.packages { 143 for meta_pkg in meta.packages {
143 let is_member = ws_members.contains(&meta_pkg.id); 144 let is_member = ws_members.contains(&meta_pkg.id);
145 let name = meta_pkg.name;
144 let pkg = packages.alloc(PackageData { 146 let pkg = packages.alloc(PackageData {
145 name: meta_pkg.name, 147 name: name.clone(),
146 manifest: meta_pkg.manifest_path.clone(), 148 manifest: meta_pkg.manifest_path.clone(),
147 targets: Vec::new(), 149 targets: Vec::new(),
148 is_member, 150 is_member,
149 edition: Edition::from_string(&meta_pkg.edition), 151 edition: Edition::from_str(&meta_pkg.edition)
152 .unwrap_or_else(|e| panic!("unknown edition {} for package {:?}", e, &name)),
150 dependencies: Vec::new(), 153 dependencies: Vec::new(),
151 features: Vec::new(), 154 features: Vec::new(),
152 }); 155 });