Skip to content

Commit 6211d20

Browse files
authored
Eliminate dependency on serde's "derive" feature (#694)
This allows serde, and other crates downstream of it like serde_json, to compile in parallel with serde_derive. Without this PR, in any dependency graph that pulls in serde_with, first serde_derive would need to compile, then serde would need to compile, then serde_json would need to compile. sharkdp/bat#2815 has a diagram of the impact of this change.
2 parents d145a45 + 5e6a115 commit 6211d20

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

serde_with/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ hex = {version = "0.4.3", optional = true, default-features = false}
130130
indexmap_1 = {package = "indexmap", version = "1.8", optional = true, default-features = false, features = ["serde-1"]}
131131
indexmap_2 = {package = "indexmap", version = "2.0", optional = true, default-features = false, features = ["serde"]}
132132
schemars_0_8 = {package = "schemars", version = "0.8.16", optional = true, default-features = false}
133-
# The derive feature is needed for the flattened_maybe macro.
134-
# https://github.com/jonasbb/serde_with/blob/eb1965a74a3be073ecd13ec05f02a01bc1c44309/serde_with/src/flatten_maybe.rs#L67
135-
serde = {version = "1.0.152", default-features = false, features = ["derive"] }
133+
serde = {version = "1.0.152", default-features = false}
134+
serde_derive = "1.0.152"
136135
serde_json = {version = "1.0.45", optional = true, default-features = false}
137136
serde_with_macros = {path = "../serde_with_macros", version = "=3.6.0", optional = true}
138137
time_0_3 = {package = "time", version = "~0.3.11", optional = true, default-features = false}
@@ -149,6 +148,7 @@ rmp-serde = "1.1.0"
149148
ron = "0.8"
150149
rustversion = "1.0.0"
151150
schemars_0_8 = {package = "schemars", version = "0.8.16"}
151+
serde = {version = "1.0.152", default-features = false, features = ["derive"]}
152152
serde_json = {version = "1.0.25", features = ["preserve_order"]}
153153
serde_test = "1.0.124"
154154
serde_yaml = "0.9.2"

serde_with/src/flatten_maybe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ macro_rules! flattened_maybe {
6464
serde,
6565
};
6666

67-
#[derive($crate::serde::Deserialize)]
67+
#[derive($crate::serde_derive::Deserialize)]
6868
#[serde(crate = "serde")]
6969
pub struct Both<T> {
7070
#[serde(flatten)]

serde_with/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ extern crate alloc;
296296
pub extern crate core;
297297
#[doc(hidden)]
298298
pub extern crate serde;
299+
#[doc(hidden)]
300+
pub extern crate serde_derive;
299301
#[cfg(feature = "std")]
300302
extern crate std;
301303

0 commit comments

Comments
 (0)