Fix clippy errors
This commit is contained in:
parent
a728b6666c
commit
438e164ffd
15 changed files with 36 additions and 36 deletions
|
|
@ -14,7 +14,7 @@ where
|
|||
{
|
||||
struct Wrapper<'a>(&'a [u8]);
|
||||
|
||||
impl<'a> Serialize for Wrapper<'a> {
|
||||
impl Serialize for Wrapper<'_> {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
|
|
|
|||
|
|
@ -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<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
||||
|
|
@ -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<K>(&mut self, seed: K) -> Result<Option<K::Value>, 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<T>(&mut self, seed: T) -> Result<Option<T::Value>, Self::Error>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ impl<W: std::io::Write> BencodeSerializer<W> {
|
|||
struct SerializeSeq<'ser, W: std::io::Write> {
|
||||
ser: &'ser mut BencodeSerializer<W>,
|
||||
}
|
||||
impl<'ser, W: std::io::Write> serde::ser::SerializeSeq for SerializeSeq<'ser, W> {
|
||||
impl<W: std::io::Write> 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<W>,
|
||||
}
|
||||
impl<'ser, W: std::io::Write> serde::ser::SerializeTuple for SerializeTuple<'ser, W> {
|
||||
impl<W: std::io::Write> serde::ser::SerializeTuple for SerializeTuple<'_, W> {
|
||||
type Ok = ();
|
||||
|
||||
type Error = SerError;
|
||||
|
|
@ -139,7 +139,7 @@ struct SerializeMap<'ser, W: std::io::Write> {
|
|||
tmp: BTreeMap<ByteBufOwned, ByteBufOwned>,
|
||||
last_key: Option<ByteBufOwned>,
|
||||
}
|
||||
impl<'ser, W: std::io::Write> serde::ser::SerializeMap for SerializeMap<'ser, W> {
|
||||
impl<W: std::io::Write> 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<W>,
|
||||
tmp: BTreeMap<&'static str, ByteBufOwned>,
|
||||
}
|
||||
impl<'ser, W: std::io::Write> serde::ser::SerializeStruct for SerializeStruct<'ser, W> {
|
||||
impl<W: std::io::Write> serde::ser::SerializeStruct for SerializeStruct<'_, W> {
|
||||
type Ok = ();
|
||||
|
||||
type Error = SerError;
|
||||
|
|
|
|||
|
|
@ -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<Bytes> for ByteBufOwned {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> serde::ser::Serialize for ByteBuf<'a> {
|
||||
impl serde::ser::Serialize for ByteBuf<'_> {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ impl Serialize for PeerStore {
|
|||
peers: &'a dashmap::DashMap<Id20, Vec<StoredPeer>>,
|
||||
}
|
||||
|
||||
impl<'a> Serialize for SerializePeers<'a> {
|
||||
impl Serialize for SerializePeers<'_> {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ impl Subscriber {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> MakeWriter<'a> for Subscriber {
|
||||
impl MakeWriter<'_> for Subscriber {
|
||||
type Writer = LineWriter<Writer>;
|
||||
|
||||
fn make_writer(&self) -> Self::Writer {
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ pub enum FileIteratorName<'a, BufType> {
|
|||
Tree(&'a [BufType]),
|
||||
}
|
||||
|
||||
impl<'a, BufType> std::fmt::Debug for FileIteratorName<'a, BufType>
|
||||
impl<BufType> 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<BufType> FileDetails<'_, BufType>
|
||||
where
|
||||
BufType: AsRef<[u8]>,
|
||||
{
|
||||
|
|
@ -235,7 +235,7 @@ pub struct FileDetailsExt<'a, BufType> {
|
|||
pub pieces: std::ops::Range<u32>,
|
||||
}
|
||||
|
||||
impl<'a, BufType> FileDetailsExt<'a, BufType> {
|
||||
impl<BufType> FileDetailsExt<'_, BufType> {
|
||||
pub fn pieces_usize(&self) -> std::ops::Range<usize> {
|
||||
self.pieces.start as usize..self.pieces.end as usize
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ impl ExtendedHandshake<ByteBuf<'static>> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, ByteBuf> ExtendedHandshake<ByteBuf>
|
||||
impl<ByteBuf> ExtendedHandshake<ByteBuf>
|
||||
where
|
||||
ByteBuf: ByteBufT,
|
||||
{
|
||||
fn get_msgid(&self, msg_type: &'a [u8]) -> Option<u8> {
|
||||
fn get_msgid(&self, msg_type: &[u8]) -> Option<u8> {
|
||||
self.m.get(msg_type).copied()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ where
|
|||
struct Visitor<T> {
|
||||
p: PhantomData<T>,
|
||||
}
|
||||
impl<'de, T> serde::de::Visitor<'de> for Visitor<T>
|
||||
impl<T> serde::de::Visitor<'_> for Visitor<T>
|
||||
where
|
||||
T: IpLike,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue