diff --git a/crates/bencode/src/raw_value.rs b/crates/bencode/src/raw_value.rs index fbeceb8..0d3fd8f 100644 --- a/crates/bencode/src/raw_value.rs +++ b/crates/bencode/src/raw_value.rs @@ -14,7 +14,7 @@ where { struct Wrapper<'a>(&'a [u8]); - impl<'a> Serialize for Wrapper<'a> { + impl Serialize for Wrapper<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crates/bencode/src/serde_bencode_de.rs b/crates/bencode/src/serde_bencode_de.rs index 1e4666f..83bef6d 100644 --- a/crates/bencode/src/serde_bencode_de.rs +++ b/crates/bencode/src/serde_bencode_de.rs @@ -202,7 +202,7 @@ impl serde::de::Error for Error { } } -impl<'de, 'a> serde::de::Deserializer<'de> for &'a mut BencodeDeserializer<'de> { +impl<'de> serde::de::Deserializer<'de> for &mut BencodeDeserializer<'de> { type Error = Error; fn deserialize_any(self, visitor: V) -> Result @@ -517,7 +517,7 @@ struct SeqAccess<'a, 'de> { de: &'a mut BencodeDeserializer<'de>, } -impl<'a, 'de> serde::de::MapAccess<'de> for MapAccess<'a, 'de> { +impl<'de> serde::de::MapAccess<'de> for MapAccess<'_, 'de> { type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result, Self::Error> @@ -559,7 +559,7 @@ impl<'a, 'de> serde::de::MapAccess<'de> for MapAccess<'a, 'de> { } } -impl<'a, 'de> serde::de::SeqAccess<'de> for SeqAccess<'a, 'de> { +impl<'de> serde::de::SeqAccess<'de> for SeqAccess<'_, 'de> { type Error = Error; fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> diff --git a/crates/bencode/src/serde_bencode_ser.rs b/crates/bencode/src/serde_bencode_ser.rs index 0618b99..98a4a27 100644 --- a/crates/bencode/src/serde_bencode_ser.rs +++ b/crates/bencode/src/serde_bencode_ser.rs @@ -97,7 +97,7 @@ impl BencodeSerializer { struct SerializeSeq<'ser, W: std::io::Write> { ser: &'ser mut BencodeSerializer, } -impl<'ser, W: std::io::Write> serde::ser::SerializeSeq for SerializeSeq<'ser, W> { +impl serde::ser::SerializeSeq for SerializeSeq<'_, W> { type Ok = (); type Error = SerError; @@ -117,7 +117,7 @@ impl<'ser, W: std::io::Write> serde::ser::SerializeSeq for SerializeSeq<'ser, W> struct SerializeTuple<'ser, W: std::io::Write> { ser: &'ser mut BencodeSerializer, } -impl<'ser, W: std::io::Write> serde::ser::SerializeTuple for SerializeTuple<'ser, W> { +impl serde::ser::SerializeTuple for SerializeTuple<'_, W> { type Ok = (); type Error = SerError; @@ -139,7 +139,7 @@ struct SerializeMap<'ser, W: std::io::Write> { tmp: BTreeMap, last_key: Option, } -impl<'ser, W: std::io::Write> serde::ser::SerializeMap for SerializeMap<'ser, W> { +impl serde::ser::SerializeMap for SerializeMap<'_, W> { type Ok = (); type Error = SerError; @@ -182,7 +182,7 @@ struct SerializeStruct<'ser, W: std::io::Write> { ser: &'ser mut BencodeSerializer, tmp: BTreeMap<&'static str, ByteBufOwned>, } -impl<'ser, W: std::io::Write> serde::ser::SerializeStruct for SerializeStruct<'ser, W> { +impl serde::ser::SerializeStruct for SerializeStruct<'_, W> { type Ok = (); type Error = SerError; diff --git a/crates/buffers/src/lib.rs b/crates/buffers/src/lib.rs index f6cae86..fab3178 100644 --- a/crates/buffers/src/lib.rs +++ b/crates/buffers/src/lib.rs @@ -29,14 +29,14 @@ impl ByteBufT for ByteBufOwned { } } -impl<'a> ByteBufT for ByteBuf<'a> { +impl ByteBufT for ByteBuf<'_> { fn as_slice(&self) -> &[u8] { self.as_ref() } } struct HexBytes<'a>(&'a [u8]); -impl<'a> std::fmt::Display for HexBytes<'a> { +impl std::fmt::Display for HexBytes<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { for byte in self.0 { write!(f, "{byte:02x?}")?; @@ -71,13 +71,13 @@ fn debug_bytes(b: &[u8], f: &mut std::fmt::Formatter<'_>, debug_strings: bool) - write!(f, "<{} bytes>", b.len()) } -impl<'a> std::fmt::Debug for ByteBuf<'a> { +impl std::fmt::Debug for ByteBuf<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { debug_bytes(self.0, f, true) } } -impl<'a> std::fmt::Display for ByteBuf<'a> { +impl std::fmt::Display for ByteBuf<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { debug_bytes(self.0, f, false) } @@ -95,7 +95,7 @@ impl std::fmt::Display for ByteBufOwned { } } -impl<'a> CloneToOwned for ByteBuf<'a> { +impl CloneToOwned for ByteBuf<'_> { type Target = ByteBufOwned; fn clone_to_owned(&self, within_buffer: Option<&Bytes>) -> Self::Target { @@ -126,7 +126,7 @@ impl CloneToOwned for ByteBufOwned { } } -impl<'a> std::convert::AsRef<[u8]> for ByteBuf<'a> { +impl std::convert::AsRef<[u8]> for ByteBuf<'_> { fn as_ref(&self) -> &[u8] { self.0 } @@ -144,13 +144,13 @@ impl std::borrow::Borrow<[u8]> for ByteBufOwned { } } -impl<'a> std::borrow::Borrow<[u8]> for ByteBuf<'a> { +impl std::borrow::Borrow<[u8]> for ByteBuf<'_> { fn borrow(&self) -> &[u8] { self.0 } } -impl<'a> std::ops::Deref for ByteBuf<'a> { +impl std::ops::Deref for ByteBuf<'_> { type Target = [u8]; fn deref(&self) -> &Self::Target { @@ -190,7 +190,7 @@ impl From for ByteBufOwned { } } -impl<'a> serde::ser::Serialize for ByteBuf<'a> { +impl serde::ser::Serialize for ByteBuf<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -215,7 +215,7 @@ impl<'de> serde::de::Deserialize<'de> for ByteBufOwned { { struct Visitor; - impl<'de> serde::de::Visitor<'de> for Visitor { + impl serde::de::Visitor<'_> for Visitor { type Value = ByteBufOwned; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/crates/dht/src/bprotocol.rs b/crates/dht/src/bprotocol.rs index 56e09a1..522291f 100644 --- a/crates/dht/src/bprotocol.rs +++ b/crates/dht/src/bprotocol.rs @@ -27,7 +27,7 @@ impl<'de> Deserialize<'de> for MessageType { D: serde::Deserializer<'de>, { struct Visitor; - impl<'de> serde::de::Visitor<'de> for Visitor { + impl serde::de::Visitor<'_> for Visitor { type Value = MessageType; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { @@ -271,7 +271,7 @@ impl<'de> Deserialize<'de> for CompactPeerInfo { D: Deserializer<'de>, { struct Visitor; - impl<'de> serde::de::Visitor<'de> for Visitor { + impl serde::de::Visitor<'_> for Visitor { type Value = CompactPeerInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/crates/dht/src/peer_store.rs b/crates/dht/src/peer_store.rs index 8ca8d76..e01e49b 100644 --- a/crates/dht/src/peer_store.rs +++ b/crates/dht/src/peer_store.rs @@ -51,7 +51,7 @@ impl Serialize for PeerStore { peers: &'a dashmap::DashMap>, } - impl<'a> Serialize for SerializePeers<'a> { + impl Serialize for SerializePeers<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crates/dht/src/routing_table.rs b/crates/dht/src/routing_table.rs index 8f4e7e8..3857781 100644 --- a/crates/dht/src/routing_table.rs +++ b/crates/dht/src/routing_table.rs @@ -83,7 +83,7 @@ pub struct BucketTreeIteratorItem<'a> { pub leaf: &'a LeafBucket, } -impl<'a> BucketTreeIteratorItem<'a> { +impl BucketTreeIteratorItem<'_> { pub fn random_within(&self) -> Id20 { generate_random_id(self.start, self.bits) } diff --git a/crates/librqbit/src/file_ops.rs b/crates/librqbit/src/file_ops.rs index 1c84237..c40c570 100644 --- a/crates/librqbit/src/file_ops.rs +++ b/crates/librqbit/src/file_ops.rs @@ -85,7 +85,7 @@ impl<'a> FileOps<'a> { processed_bytes: u64, is_broken: bool, } - impl<'a> CurrentFile<'a> { + impl CurrentFile<'_> { fn remaining(&self) -> u64 { self.fi.len - self.processed_bytes } diff --git a/crates/librqbit/src/tracing_subscriber_config_utils.rs b/crates/librqbit/src/tracing_subscriber_config_utils.rs index e4856c2..fab8827 100644 --- a/crates/librqbit/src/tracing_subscriber_config_utils.rs +++ b/crates/librqbit/src/tracing_subscriber_config_utils.rs @@ -23,7 +23,7 @@ impl Subscriber { } } -impl<'a> MakeWriter<'a> for Subscriber { +impl MakeWriter<'_> for Subscriber { type Writer = LineWriter; fn make_writer(&self) -> Self::Writer { diff --git a/crates/librqbit_core/src/torrent_metainfo.rs b/crates/librqbit_core/src/torrent_metainfo.rs index 2a22a90..80db56a 100644 --- a/crates/librqbit_core/src/torrent_metainfo.rs +++ b/crates/librqbit_core/src/torrent_metainfo.rs @@ -125,7 +125,7 @@ pub enum FileIteratorName<'a, BufType> { Tree(&'a [BufType]), } -impl<'a, BufType> std::fmt::Debug for FileIteratorName<'a, BufType> +impl std::fmt::Debug for FileIteratorName<'_, BufType> where BufType: AsRef<[u8]>, { @@ -203,7 +203,7 @@ pub struct FileDetails<'a, BufType> { pub symlink_path: Option<&'a [BufType]>, } -impl<'a, BufType> FileDetails<'a, BufType> +impl FileDetails<'_, BufType> where BufType: AsRef<[u8]>, { @@ -235,7 +235,7 @@ pub struct FileDetailsExt<'a, BufType> { pub pieces: std::ops::Range, } -impl<'a, BufType> FileDetailsExt<'a, BufType> { +impl FileDetailsExt<'_, BufType> { pub fn pieces_usize(&self) -> std::ops::Range { self.pieces.start as usize..self.pieces.end as usize } diff --git a/crates/peer_binary_protocol/src/extended/handshake.rs b/crates/peer_binary_protocol/src/extended/handshake.rs index 2a6824d..b48396b 100644 --- a/crates/peer_binary_protocol/src/extended/handshake.rs +++ b/crates/peer_binary_protocol/src/extended/handshake.rs @@ -47,11 +47,11 @@ impl ExtendedHandshake> { } } -impl<'a, ByteBuf> ExtendedHandshake +impl ExtendedHandshake where ByteBuf: ByteBufT, { - fn get_msgid(&self, msg_type: &'a [u8]) -> Option { + fn get_msgid(&self, msg_type: &[u8]) -> Option { self.m.get(msg_type).copied() } diff --git a/crates/peer_binary_protocol/src/extended/ip.rs b/crates/peer_binary_protocol/src/extended/ip.rs index ad68abf..4f5e173 100644 --- a/crates/peer_binary_protocol/src/extended/ip.rs +++ b/crates/peer_binary_protocol/src/extended/ip.rs @@ -105,7 +105,7 @@ where struct Visitor { p: PhantomData, } - impl<'de, T> serde::de::Visitor<'de> for Visitor + impl serde::de::Visitor<'_> for Visitor where T: IpLike, { diff --git a/crates/peer_binary_protocol/src/lib.rs b/crates/peer_binary_protocol/src/lib.rs index bd9a83e..14cb39e 100644 --- a/crates/peer_binary_protocol/src/lib.rs +++ b/crates/peer_binary_protocol/src/lib.rs @@ -246,7 +246,7 @@ impl<'a> Bitfield<'a> { } } -impl<'a> std::fmt::Debug for Bitfield<'a> { +impl std::fmt::Debug for Bitfield<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Bitfield") .field("_ones", &self.data.count_ones()) diff --git a/crates/tracker_comms/src/tracker_comms_http.rs b/crates/tracker_comms/src/tracker_comms_http.rs index e3ae946..0cb62f4 100644 --- a/crates/tracker_comms/src/tracker_comms_http.rs +++ b/crates/tracker_comms/src/tracker_comms_http.rs @@ -52,7 +52,7 @@ pub struct DictPeer<'a> { port: u16, } -impl<'a> DictPeer<'a> { +impl DictPeer<'_> { fn as_sockaddr(&self) -> SocketAddr { SocketAddr::new(self.ip, self.port) } @@ -118,7 +118,7 @@ where D: Deserializer<'de>, { struct Visitor; - impl<'de> serde::de::Visitor<'de> for Visitor { + impl serde::de::Visitor<'_> for Visitor { type Value = IpAddr; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/crates/upnp-serve/src/ssdp.rs b/crates/upnp-serve/src/ssdp.rs index 7fa3cfb..d3fc29b 100644 --- a/crates/upnp-serve/src/ssdp.rs +++ b/crates/upnp-serve/src/ssdp.rs @@ -39,7 +39,7 @@ pub struct SsdpMSearchRequest<'a> { pub st: &'a BStr, } -impl<'a> SsdpMSearchRequest<'a> { +impl SsdpMSearchRequest<'_> { fn matches_media_server(&self) -> bool { if self.man != "\"ssdp:discover\"" { return false; @@ -81,7 +81,7 @@ pub fn try_parse_ssdp<'a, 'h>( match (host, man, st) { (Some(host), Some(man), Some(st)) => { - return Ok(SsdpMessage::MSearch(SsdpMSearchRequest { + Ok(SsdpMessage::MSearch(SsdpMSearchRequest { host: BStr::new(host), man: BStr::new(man), st: BStr::new(st), @@ -90,7 +90,7 @@ pub fn try_parse_ssdp<'a, 'h>( _ => bail!("not all of host, man and st are set"), } } - _ => return Ok(SsdpMessage::OtherRequest(req)), + _ => Ok(SsdpMessage::OtherRequest(req)), } }