diff options
Diffstat (limited to 'crates/ra_project_model/src/cargo_workspace.rs')
-rw-r--r-- | crates/ra_project_model/src/cargo_workspace.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 5866be519..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}; | |||
4 | use ra_arena::{Arena, RawId, impl_arena_id}; | 4 | use ra_arena::{Arena, RawId, impl_arena_id}; |
5 | use rustc_hash::FxHashMap; | 5 | use rustc_hash::FxHashMap; |
6 | use failure::format_err; | 6 | use failure::format_err; |
7 | use ra_db::Edition; | ||
7 | 8 | ||
8 | use crate::Result; | 9 | use crate::Result; |
9 | 10 | ||
@@ -35,6 +36,7 @@ struct PackageData { | |||
35 | targets: Vec<Target>, | 36 | targets: Vec<Target>, |
36 | is_member: bool, | 37 | is_member: bool, |
37 | dependencies: Vec<PackageDependency>, | 38 | dependencies: Vec<PackageDependency>, |
39 | edition: Edition, | ||
38 | } | 40 | } |
39 | 41 | ||
40 | #[derive(Debug, Clone)] | 42 | #[derive(Debug, Clone)] |
@@ -84,6 +86,9 @@ impl Package { | |||
84 | pub fn root(self, ws: &CargoWorkspace) -> &Path { | 86 | pub fn root(self, ws: &CargoWorkspace) -> &Path { |
85 | ws.packages[self].manifest.parent().unwrap() | 87 | ws.packages[self].manifest.parent().unwrap() |
86 | } | 88 | } |
89 | pub fn edition(self, ws: &CargoWorkspace) -> Edition { | ||
90 | ws.packages[self].edition | ||
91 | } | ||
87 | pub fn targets<'a>(self, ws: &'a CargoWorkspace) -> impl Iterator<Item = Target> + 'a { | 92 | pub fn targets<'a>(self, ws: &'a CargoWorkspace) -> impl Iterator<Item = Target> + 'a { |
88 | ws.packages[self].targets.iter().cloned() | 93 | ws.packages[self].targets.iter().cloned() |
89 | } | 94 | } |
@@ -135,6 +140,7 @@ impl CargoWorkspace { | |||
135 | manifest: meta_pkg.manifest_path.clone(), | 140 | manifest: meta_pkg.manifest_path.clone(), |
136 | targets: Vec::new(), | 141 | targets: Vec::new(), |
137 | is_member, | 142 | is_member, |
143 | edition: Edition::from_string(&meta_pkg.edition), | ||
138 | dependencies: Vec::new(), | 144 | dependencies: Vec::new(), |
139 | }); | 145 | }); |
140 | let pkg_data = &mut packages[pkg]; | 146 | let pkg_data = &mut packages[pkg]; |