*: Fix clippy warnings (#2227)

This commit is contained in:
Roman
2021-09-14 16:00:05 +03:00
committed by GitHub
parent 5f68c74177
commit b79fd02f0b
25 changed files with 93 additions and 124 deletions

View File

@ -675,7 +675,7 @@ where
} => NetworkBehaviourAction::NotifyHandler {
peer_id,
handler,
event: event,
event,
},
NetworkBehaviourAction::ReportObservedAddr { address, score } => {
NetworkBehaviourAction::ReportObservedAddr { address, score }

View File

@ -333,7 +333,7 @@ where
pub fn dial_addr(&mut self, addr: Multiaddr) -> Result<(), DialError> {
let handler = self.behaviour.new_handler();
self.dial_addr_with_handler(addr, handler)
.map_err(|e| DialError::from_network_dial_error(e))
.map_err(DialError::from_network_dial_error)
.map_err(|(e, _)| e)
}
@ -392,7 +392,7 @@ where
Err(error) => {
let (error, handler) = DialError::from_network_dial_error(error);
self.behaviour.inject_dial_failure(
&peer_id,
peer_id,
handler.into_protocols_handler(),
error.clone(),
);
@ -1051,7 +1051,7 @@ impl<'a> PollParameters for SwarmPollParameters<'a> {
}
fn local_peer_id(&self) -> &PeerId {
&self.local_peer_id
self.local_peer_id
}
}

View File

@ -523,10 +523,7 @@ pub enum KeepAlive {
impl KeepAlive {
/// Returns true for `Yes`, false otherwise.
pub fn is_yes(&self) -> bool {
match *self {
KeepAlive::Yes => true,
_ => false,
}
matches!(*self, KeepAlive::Yes)
}
}

View File

@ -285,7 +285,7 @@ impl<'a> Iterator for AddressIter<'a> {
}
let item = &self.items[self.offset];
self.offset += 1;
Some(&item)
Some(item)
}
fn size_hint(&self) -> (usize, Option<usize>) {