aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLizzy Fleckenstein <eliasfleckenstein@web.de>2023-01-07 00:49:04 +0100
committerLizzy Fleckenstein <eliasfleckenstein@web.de>2023-01-07 00:49:04 +0100
commit9cf950fd1618dc888b6271346386acc64c282177 (patch)
tree31b3977a2792e2fb5e001bf5c09514fe54b44e7c /src
parenta8c974d5cf836cc7f2a2f0ed47287aed77c2d7fd (diff)
downloadmt_rudp-9cf950fd1618dc888b6271346386acc64c282177.tar.xz
clippy
Diffstat (limited to 'src')
-rw-r--r--src/client.rs4
-rw-r--r--src/error.rs2
-rw-r--r--src/recv.rs1
-rw-r--r--src/send.rs3
4 files changed, 6 insertions, 4 deletions
diff --git a/src/client.rs b/src/client.rs
index e6d7e75..6785a1f 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -36,7 +36,7 @@ pub async fn connect(addr: &str) -> io::Result<(RudpSender<Sender>, RudpReceiver
let sock = Arc::new(net::UdpSocket::bind("0.0.0.0:0").await?);
sock.connect(addr).await?;
- Ok(new(
+ new(
PeerID::Srv as u16,
PeerID::Nil as u16,
Sender {
@@ -44,5 +44,5 @@ pub async fn connect(addr: &str) -> io::Result<(RudpSender<Sender>, RudpReceiver
},
Receiver { sock },
)
- .await?)
+ .await
}
diff --git a/src/error.rs b/src/error.rs
index e048120..55566fa 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -47,7 +47,7 @@ impl fmt::Display for Error {
write!(f, "rudp: ")?;
match self {
- IoError(err) => write!(f, "IO error: {}", err),
+ IoError(err) => write!(f, "IO error: {err}"),
InvalidProtoId(id) => write!(f, "invalid protocol ID: {id}"),
InvalidChannel(ch) => write!(f, "invalid channel: {ch}"),
InvalidType(tp) => write!(f, "invalid type: {tp}"),
diff --git a/src/recv.rs b/src/recv.rs
index e3d3e6b..e685c9c 100644
--- a/src/recv.rs
+++ b/src/recv.rs
@@ -82,6 +82,7 @@ impl<R: UdpReceiver, S: UdpSender> RecvWorker<R, S> {
self.pkt_tx.send(Err(RemoteDisco(to))).ok();
}
+ #[allow(clippy::single_match)]
match e {
// anon5's mt notifies the peer on timeout, C++ MT does not
LocalDisco /*| RemoteDisco(true)*/ => drop(
diff --git a/src/send.rs b/src/send.rs
index c41ad80..3ec3c64 100644
--- a/src/send.rs
+++ b/src/send.rs
@@ -12,11 +12,12 @@ impl<S: UdpSender> RudpSender<S> {
}
impl<S: UdpSender> RudpShare<S> {
+ #[allow(clippy::unused_io_amount)]
pub async fn send(&self, tp: PktType, pkt: Pkt<&[u8]>) -> AckResult {
let mut buf = Vec::with_capacity(4 + 2 + 1 + 1 + 2 + 1 + pkt.data.len());
buf.write_u32::<BigEndian>(PROTO_ID)?;
buf.write_u16::<BigEndian>(*self.remote_id.read().await)?;
- buf.write_u8(pkt.chan as u8)?;
+ buf.write_u8(pkt.chan)?;
let mut chan = self.chans[pkt.chan as usize].lock().await;
let seqnum = chan.seqnum;