diff --git a/src/net/cache.rs b/src/net/cache.rs
index c539618..db24d00 100644
--- a/src/net/cache.rs
+++ b/src/net/cache.rs
@@ -17,7 +17,7 @@
* .
*/
-use std::{cmp::Ordering, sync::Arc};
+use std::cmp::Ordering;
use rayon::prelude::*;
diff --git a/src/net/player.rs b/src/net/player.rs
index 75f369a..ef88929 100644
--- a/src/net/player.rs
+++ b/src/net/player.rs
@@ -32,9 +32,8 @@ use thiserror::Error;
use tokio::{
net::TcpStream,
sync::{Mutex, OwnedSemaphorePermit, RwLock},
- time::{self, timeout, Instant},
+ time::{timeout, Instant},
};
-use tokio_util::sync::CancellationToken;
use uuid::Uuid;
use crate::{
@@ -271,8 +270,7 @@ impl SharedPlayer {
data: Bounded(Bytes(&[3])),
};
- let mut io = self.0.io.lock().await;
- io.tx(&req).await?;
+ self.0.io.tx(&req).await?;
Ok(())
}
@@ -503,10 +501,13 @@ impl SharedPlayer {
let mut queue = player.0.frame_queue.lock().await;
queue.push(frame);
}
- Err(why) => match why.downcast_ref::().map(|e| e.kind()) {
- Some(tokio::io::ErrorKind::UnexpectedEof) => return,
- _ => (),
- },
+ Err(why) => {
+ if let Some(tokio::io::ErrorKind::UnexpectedEof) =
+ why.downcast_ref::().map(|e| e.kind())
+ {
+ return;
+ }
+ }
}
}
});
@@ -518,12 +519,9 @@ impl SharedPlayer {
let packet: SetPlayerPositionS = frame.decode()?;
let tp_state = self.0.tp_state.read().await;
- match *tp_state {
- TeleportState::Clear => {
- let mut entity = self.0.entity.write().await;
- entity.reposition(packet.x, packet.feet_y, packet.z);
- }
- _ => (),
+ if *tp_state == TeleportState::Clear {
+ let mut entity = self.0.entity.write().await;
+ entity.reposition(packet.x, packet.feet_y, packet.z);
}
}
@@ -531,13 +529,10 @@ impl SharedPlayer {
let packet: SetPlayerPositionAndRotationS = frame.decode()?;
let tp_state = self.0.tp_state.read().await;
- match *tp_state {
- TeleportState::Clear => {
- let mut entity = self.0.entity.write().await;
- entity.reposition(packet.x, packet.feet_y, packet.z);
- entity.rotate(packet.yaw, packet.pitch);
- }
- _ => (),
+ if *tp_state == TeleportState::Clear {
+ let mut entity = self.0.entity.write().await;
+ entity.reposition(packet.x, packet.feet_y, packet.z);
+ entity.rotate(packet.yaw, packet.pitch);
}
}
diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs
index 6a6848c..52479b8 100644
--- a/src/protocol/mod.rs
+++ b/src/protocol/mod.rs
@@ -27,7 +27,7 @@ pub mod datatypes {
pub use impls::*;
pub use position::*;
- pub use slot::*;
+
pub use string::*;
pub use text_component::*;
pub use variable::*;
diff --git a/src/protocol/packets/play/world.rs b/src/protocol/packets/play/world.rs
index 97f8e48..b7dcaac 100644
--- a/src/protocol/packets/play/world.rs
+++ b/src/protocol/packets/play/world.rs
@@ -17,7 +17,7 @@
* .
*/
-use std::{collections::HashMap, sync::Arc};
+use std::collections::HashMap;
use bit_vec::BitVec;
use bytes::BufMut;
diff --git a/src/server/mod.rs b/src/server/mod.rs
index ca5cf04..aff68ad 100644
--- a/src/server/mod.rs
+++ b/src/server/mod.rs
@@ -86,7 +86,7 @@ impl Server {
}
{
- if player.0.io.connected().await == false {
+ if !player.0.io.connected().await {
invalid_players.insert(*id);
}
}