mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +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,
|
local: bool,
|
||||||
alternative: bool,
|
alternative: bool,
|
||||||
invalid_json: bool,
|
invalid_json: bool,
|
||||||
|
edition: Option<String>,
|
||||||
resolver: Option<String>,
|
resolver: Option<String>,
|
||||||
proc_macro: bool,
|
proc_macro: bool,
|
||||||
links: Option<String>,
|
links: Option<String>,
|
||||||
@ -1251,6 +1252,7 @@ impl Package {
|
|||||||
local: false,
|
local: false,
|
||||||
alternative: false,
|
alternative: false,
|
||||||
invalid_json: false,
|
invalid_json: false,
|
||||||
|
edition: None,
|
||||||
resolver: None,
|
resolver: None,
|
||||||
proc_macro: false,
|
proc_macro: false,
|
||||||
links: None,
|
links: None,
|
||||||
@ -1387,6 +1389,12 @@ impl Package {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Specifies `package.edition`
|
||||||
|
pub fn edition(&mut self, edition: &str) -> &mut Package {
|
||||||
|
self.edition = Some(edition.to_owned());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Specifies `package.resolver`
|
/// Specifies `package.resolver`
|
||||||
pub fn resolver(&mut self, resolver: &str) -> &mut Package {
|
pub fn resolver(&mut self, resolver: &str) -> &mut Package {
|
||||||
self.resolver = Some(resolver.to_owned());
|
self.resolver = Some(resolver.to_owned());
|
||||||
@ -1581,6 +1589,10 @@ impl Package {
|
|||||||
manifest.push_str(&format!("rust-version = \"{}\"\n", version));
|
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 {
|
if let Some(resolver) = &self.resolver {
|
||||||
manifest.push_str(&format!("resolver = \"{}\"\n", resolver));
|
manifest.push_str(&format!("resolver = \"{}\"\n", resolver));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user