aboutsummaryrefslogtreecommitdiff
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
parenta8c974d5cf836cc7f2a2f0ed47287aed77c2d7fd (diff)
downloadmt_rudp-9cf950fd1618dc888b6271346386acc64c282177.tar.xz
clippy
-rw-r--r--Cargo.toml2
-rw-r--r--src/client.rs4
-rw-r--r--src/error.rs2
-rw-r--r--src/recv.rs1
-rw-r--r--src/send.rs3
5 files changed, 7 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 1805a8c..53ab291 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,4 +12,4 @@ tokio = { version = "1.23.0", features = ["sync", "time", "net", "signal", "macr
[dev-dependencies]
pretty-hex = "0.3.0"
-tokio = { features = ["rt-multi-thread"] }
+tokio = { version = "1.23.0", features = ["rt-multi-thread"] }
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;