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