diff --git a/crates/cargo-test-support/src/registry.rs b/crates/cargo-test-support/src/registry.rs index 18a719a6a..207cf74a6 100644 --- a/crates/cargo-test-support/src/registry.rs +++ b/crates/cargo-test-support/src/registry.rs @@ -571,6 +571,7 @@ pub struct Package { local: bool, alternative: bool, invalid_json: bool, + edition: Option, resolver: Option, proc_macro: bool, links: Option, @@ -1251,6 +1252,7 @@ impl Package { local: false, alternative: false, invalid_json: false, + edition: None, resolver: None, proc_macro: false, links: None, @@ -1387,6 +1389,12 @@ impl Package { self } + /// Specifies `package.edition` + pub fn edition(&mut self, edition: &str) -> &mut Package { + self.edition = Some(edition.to_owned()); + self + } + /// Specifies `package.resolver` pub fn resolver(&mut self, resolver: &str) -> &mut Package { self.resolver = Some(resolver.to_owned()); @@ -1581,6 +1589,10 @@ impl Package { manifest.push_str(&format!("rust-version = \"{}\"\n", version)); } + if let Some(edition) = &self.edition { + manifest.push_str(&format!("edition = \"{}\"\n", edition)); + } + if let Some(resolver) = &self.resolver { manifest.push_str(&format!("resolver = \"{}\"\n", resolver)); }