Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Replace _serde with dep:serde in Cargo.toml #2868

Merged
merged 5 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ thiserror = "1.0"
unsigned-varint = "0.7"
void = "1"
zeroize = "1"
_serde = { package = "serde", version = "1", optional = true, features = ["derive"] }
serde = { version = "1", optional = true, features = ["derive"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ring = { version = "0.16.9", features = ["alloc", "std"], default-features = false }
Expand All @@ -62,7 +62,7 @@ prost-build = "0.11"
default = [ "secp256k1", "ecdsa" ]
secp256k1 = [ "libsecp256k1" ]
ecdsa = [ "p256" ]
serde = ["multihash/serde-codec", "_serde"]
serde = ["multihash/serde-codec", "dep:serde"]

[[bench]]
name = "peer_id"
Expand Down
3 changes: 0 additions & 3 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
//! define how to upgrade each individual substream to use a protocol.
//! See the `upgrade` module.

#[cfg(feature = "serde")]
extern crate _serde as serde;

#[allow(clippy::derive_partial_eq_without_eq)]
mod keys_proto {
include!(concat!(env!("OUT_DIR"), "/keys_proto.rs"));
Expand Down
2 changes: 1 addition & 1 deletion core/src/peer_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl From<PeerId> for Vec<u8> {
impl Serialize for PeerId {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: _serde::Serializer,
S: serde::Serializer,
{
if serializer.is_human_readable() {
serializer.serialize_str(&self.to_base58())
Expand Down
2 changes: 0 additions & 2 deletions core/tests/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use std::str::FromStr;

use libp2p_core::PeerId;

extern crate _serde as serde;

#[test]
pub fn serialize_peer_id_json() {
let peer_id = PeerId::from_str("12D3KooWRNw2pJC9748Fmq4WNV27HoSTcX3r37132FLkQMrbKAiC").unwrap();
Expand Down
4 changes: 2 additions & 2 deletions protocols/kad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] }
void = "1.0"
futures-timer = "3.0.2"
instant = "0.1.11"
_serde = { package = "serde", version = "1.0", optional = true, features = ["derive"] }
serde = { version = "1.0", optional = true, features = ["derive"] }
thiserror = "1"

[dev-dependencies]
Expand All @@ -43,4 +43,4 @@ quickcheck = "0.9.0"
prost-build = "0.11"

[features]
serde = ["_serde", "bytes/serde"]
serde = ["dep:serde", "bytes/serde"]
3 changes: 0 additions & 3 deletions protocols/kad/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
// be useful later for record store
#![allow(dead_code)]

#[cfg(feature = "serde")]
extern crate _serde as serde;

pub mod handler;
pub mod kbucket;
pub mod protocol;
Expand Down
1 change: 0 additions & 1 deletion protocols/kad/src/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ use std::hash::{Hash, Hasher};

/// The (opaque) key of a record.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "_serde"))]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Key(Bytes);

Expand Down