mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
feat(test): Allow setting edition on published packages
This commit is contained in:
parent
255f622299
commit
646e29abb5
@ -571,6 +571,7 @@ pub struct Package {
|
||||
local: bool,
|
||||
alternative: bool,
|
||||
invalid_json: bool,
|
||||
edition: Option<String>,
|
||||
resolver: Option<String>,
|
||||
proc_macro: bool,
|
||||
links: Option<String>,
|
||||
@ -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));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user