Skip to content

Commit a0d9889

Browse files
authored
chore(deps): Depend on serde_core in cargo-platform (#15992)
`cargo-platform` does not make use of serde derive macros, thus it can depend on `serde_core` instead of `serde` to speed up users' compile times. See the documentation of [`serde_core`](https://docs.rs/serde_core) for more details.
2 parents 0436f86 + cbebafb commit a0d9889

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

Cargo.lock

Lines changed: 18 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ same-file = "1.0.6"
8989
schemars = "1.0.4"
9090
security-framework = "3.3.0"
9191
semver = { version = "1.0.26", features = ["serde"] }
92-
serde = "1.0.219"
92+
serde = "1.0.220"
93+
serde_core = "1.0.220"
9394
serde-untagged = "0.1.7"
9495
serde-value = "0.7.0"
9596
serde_ignored = "0.1.12"

crates/cargo-platform/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-platform"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
edition.workspace = true
55
license.workspace = true
66
rust-version.workspace = true
@@ -10,6 +10,11 @@ documentation = "https://docs.rs/cargo-platform"
1010
description = "Cargo's representation of a target platform."
1111

1212
[dependencies]
13+
serde_core.workspace = true
14+
15+
# serde v1.0.220 is the first version that released with `serde_core`.
16+
# This is required to avoid conflict with other `serde` users which may require an older version.
17+
[target.'cfg(any())'.dependencies]
1318
serde.workspace = true
1419

1520
[lints]

crates/cargo-platform/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,22 @@ impl Platform {
140140
}
141141
}
142142

143-
impl serde::Serialize for Platform {
143+
impl serde_core::Serialize for Platform {
144144
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
145145
where
146-
S: serde::Serializer,
146+
S: serde_core::Serializer,
147147
{
148148
self.to_string().serialize(s)
149149
}
150150
}
151151

152-
impl<'de> serde::Deserialize<'de> for Platform {
152+
impl<'de> serde_core::Deserialize<'de> for Platform {
153153
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
154154
where
155-
D: serde::Deserializer<'de>,
155+
D: serde_core::Deserializer<'de>,
156156
{
157157
let s = String::deserialize(deserializer)?;
158-
FromStr::from_str(&s).map_err(serde::de::Error::custom)
158+
FromStr::from_str(&s).map_err(serde_core::de::Error::custom)
159159
}
160160
}
161161

0 commit comments

Comments
 (0)