Skip to content

Commit

Permalink
docs: add explanation for renaming crate serde to serde_crate
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoNero committed Aug 23, 2022
1 parent d0a459c commit 37ef02d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ paste = "1.0"
prost = "0.10.3"
regex = { version = "1.5", optional = true }
rustc-hex = "2.1.0"
serde_crate = { package = "serde", version = "1", features = ["derive"], optional = true }
# we rename the crate below because there is already a feature called `serde`,
# so it would conflict with the implicity feature that would be added by adding
# the `serde` crate;
# this can be fixed once rust-version is updated to 1.60.0, which solves this
# by adding the `dep:` prefix for features defined by dependencies
serde_crate = { package = "serde", version = "1", features = [
"derive",
], optional = true }
serde_json = { version = "1", optional = true }
serde_with = { version = "1.8", optional = true }
serde_yaml = { version = "0.8", optional = true }
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ extern crate clap;
extern crate log;

#[cfg(feature = "serde")]
// on the `[dependencies]` section of `Cargo.toml`, check the comments above
// the `serde_crate` dependency; we can remove this rename once we move to
// version 1.60.0 of Rust
extern crate serde_crate as serde;
#[cfg(feature = "serde")]
#[macro_use]
Expand Down

0 comments on commit 37ef02d

Please sign in to comment.