diff --git a/core/src/peer.rs b/core/src/peer.rs index 24a0640e..a300a613 100644 --- a/core/src/peer.rs +++ b/core/src/peer.rs @@ -184,7 +184,7 @@ pub struct WithId<'a> { node_key: &'a NodeKey, expiration: u64, } -impl<'a> BuilderState for WithId<'a> {} +impl BuilderState for WithId<'_> {} /// Build state where the addresses are known. pub struct WithAddresses<'a> { @@ -192,7 +192,7 @@ pub struct WithAddresses<'a> { expiration: u64, addresses: Vec, } -impl<'a> BuilderState for WithAddresses<'a> {} +impl BuilderState for WithAddresses<'_> {} impl Builder { /// Set the expiration to earliest possible value. @@ -245,7 +245,7 @@ impl<'a> Builder> { } } } -impl<'a> Builder> { +impl Builder> { /// Finish the build producing a [`PeerKey`]. pub fn build(self) -> PeerKey { let entry = PeerEntry::new( diff --git a/core/src/signer.rs b/core/src/signer.rs index c37a3a74..e16eae00 100644 --- a/core/src/signer.rs +++ b/core/src/signer.rs @@ -15,7 +15,7 @@ pub trait Signer { fn sign_jws(&self, payload: &str) -> anyhow::Result; } -impl<'a, S: Signer + Sync> Signer for &'a S { +impl Signer for &'_ S { fn algorithm(&self) -> Algorithm { (*self).algorithm() } diff --git a/core/src/stream_id.rs b/core/src/stream_id.rs index 06de2f36..bb56a5d3 100644 --- a/core/src/stream_id.rs +++ b/core/src/stream_id.rs @@ -226,7 +226,7 @@ impl<'de> Deserialize<'de> for StreamId { struct StreamIdVisitor; -impl<'de> serde::de::Visitor<'de> for StreamIdVisitor { +impl serde::de::Visitor<'_> for StreamIdVisitor { type Value = StreamId; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/event/src/bytes.rs b/event/src/bytes.rs index af019f46..f327588b 100644 --- a/event/src/bytes.rs +++ b/event/src/bytes.rs @@ -44,7 +44,7 @@ impl<'de> Deserialize<'de> for Bytes { } struct BytesVisitor; -impl<'de> Visitor<'de> for BytesVisitor { +impl Visitor<'_> for BytesVisitor { type Value = Bytes; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/event/src/lib.rs b/event/src/lib.rs index a50a387f..d6ea63d6 100644 --- a/event/src/lib.rs +++ b/event/src/lib.rs @@ -8,12 +8,14 @@ pub mod unvalidated; pub use ceramic_core::*; +/// Shared testing logic with the crate. #[cfg(test)] pub mod tests { use ceramic_core::DidDocument; use crate::unvalidated::signed::JwkSigner; + /// Pretty print json pub fn to_pretty_json(json_data: &[u8]) -> String { let json: serde_json::Value = match serde_json::from_slice(json_data) { Ok(r) => r, @@ -27,10 +29,12 @@ pub mod tests { serde_json::to_string_pretty(&json).unwrap() } + /// Serialize to pretty json pub fn serialize_to_pretty_json(data: &T) -> String { serde_json::to_string_pretty(data).unwrap() } + /// Construct a signer with a hardcoded private key pub async fn signer() -> JwkSigner { JwkSigner::new( DidDocument::new("did:key:z6Mkk3rtfoKDMMG4zyarNGwCQs44GSQ49pcYKQspHJPXSnVw"),