Merge pull request #119 from rosenpass/dev/engler/clippy

Fix all clippy warnings
This commit is contained in:
wucke13
2023-09-07 12:25:47 +02:00
committed by GitHub
2 changed files with 9 additions and 7 deletions

View File

@@ -21,13 +21,13 @@ fn generate_man() -> String {
// This function is purposely stupid and redundant // This function is purposely stupid and redundant
let man = render_man("mandoc", "./doc/rosenpass.1"); let man = render_man("mandoc", "./doc/rosenpass.1");
if man.is_ok() { if let Ok(man) = man {
return man.unwrap(); return man;
} }
let man = render_man("groff", "./doc/rosenpass.1"); let man = render_man("groff", "./doc/rosenpass.1");
if man.is_ok() { if let Ok(man) = man {
return man.unwrap(); return man;
} }
// TODO: Link to online manual here // TODO: Link to online manual here

View File

@@ -99,7 +99,7 @@ impl SocketPtr {
} }
pub fn send_to(&self, srv: &AppServer, buf: &[u8], addr: SocketAddr) -> anyhow::Result<()> { pub fn send_to(&self, srv: &AppServer, buf: &[u8], addr: SocketAddr) -> anyhow::Result<()> {
self.get(srv).send_to(&buf, addr)?; self.get(srv).send_to(buf, addr)?;
Ok(()) Ok(())
} }
} }
@@ -294,13 +294,13 @@ impl HostPathDiscoveryEndpoint {
pub fn send_scouting(&self, srv: &AppServer, buf: &[u8]) -> anyhow::Result<()> { pub fn send_scouting(&self, srv: &AppServer, buf: &[u8]) -> anyhow::Result<()> {
let (addr_off, sock_off) = self.scouting_state.get(); let (addr_off, sock_off) = self.scouting_state.get();
let mut addrs = (&self.addresses) let mut addrs = (self.addresses)
.iter() .iter()
.enumerate() .enumerate()
.cycle() .cycle()
.skip(addr_off) .skip(addr_off)
.take(self.addresses.len()); .take(self.addresses.len());
let mut sockets = (&srv.sockets) let mut sockets = (srv.sockets)
.iter() .iter()
.enumerate() .enumerate()
.cycle() .cycle()
@@ -524,9 +524,11 @@ impl AppServer {
use AppPollResult::*; use AppPollResult::*;
use KeyOutputReason::*; use KeyOutputReason::*;
match self.poll(&mut *rx)? { match self.poll(&mut *rx)? {
#[allow(clippy::redundant_closure_call)]
SendInitiation(peer) => tx_maybe_with!(peer, || self SendInitiation(peer) => tx_maybe_with!(peer, || self
.crypt .crypt
.initiate_handshake(peer.lower(), &mut *tx))?, .initiate_handshake(peer.lower(), &mut *tx))?,
#[allow(clippy::redundant_closure_call)]
SendRetransmission(peer) => tx_maybe_with!(peer, || self SendRetransmission(peer) => tx_maybe_with!(peer, || self
.crypt .crypt
.retransmit_handshake(peer.lower(), &mut *tx))?, .retransmit_handshake(peer.lower(), &mut *tx))?,