mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Use Not::not
rather than a custom is_false
function
The `is_false` function already exists in the standard library, as `Not::not`; use that in `skip_serializing_if` rather than defining an `is_false` function.
This commit is contained in:
parent
fc1518ef02
commit
262d4dd5f2
@ -1496,7 +1496,7 @@ impl TomlPlatform {
|
||||
#[derive(Serialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "unstable-schema", derive(schemars::JsonSchema))]
|
||||
pub struct InheritableLints {
|
||||
#[serde(skip_serializing_if = "is_false")]
|
||||
#[serde(skip_serializing_if = "std::ops::Not::not")]
|
||||
#[cfg_attr(feature = "unstable-schema", schemars(default))]
|
||||
pub workspace: bool,
|
||||
#[serde(flatten)]
|
||||
@ -1513,10 +1513,6 @@ impl InheritableLints {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_false(b: &bool) -> bool {
|
||||
!b
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for InheritableLints {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
|
@ -82,14 +82,10 @@ pub struct NewCrateDependency {
|
||||
pub artifact: Option<Vec<String>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub bindep_target: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "is_false")]
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub lib: bool,
|
||||
}
|
||||
|
||||
fn is_false(x: &bool) -> bool {
|
||||
*x == false
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct User {
|
||||
pub id: u32,
|
||||
|
Loading…
x
Reference in New Issue
Block a user