Fix: all clippy warns

This commit is contained in:
Alexander Medvedev committed 2024-08-19 20:08:02 +01:00
1 parent a6d9ed216d
commit de7b3aa2ea
21 files changed
+35 -53

No files matched your search

+9 -5
View File
@@ -37,11 +37,15 @@ impl Client {
self.protocol_version = handshake.protocol_version.0;
self.connection_state = handshake.next_state;
if self.connection_state == ConnectionState::Login {
if self.protocol_version < CURRENT_MC_PROTOCOL as i32 {
let protocol = self.protocol_version;
self.kick(&format!("Client outdated ({protocol}), Server uses Minecraft {CURRENT_MC_VERSION}, Protocol {CURRENT_MC_PROTOCOL}"));
} else if self.protocol_version > CURRENT_MC_PROTOCOL as i32 {
self.kick(&format!("Server outdated, Server uses Minecraft {CURRENT_MC_VERSION}, Protocol {CURRENT_MC_PROTOCOL}"));
let protocol = self.protocol_version;
match protocol.cmp(&(CURRENT_MC_PROTOCOL as i32)) {
std::cmp::Ordering::Less => {
self.kick(&format!("Client outdated ({protocol}), Server uses Minecraft {CURRENT_MC_VERSION}, Protocol {CURRENT_MC_PROTOCOL}"));
}
std::cmp::Ordering::Equal => {}
std::cmp::Ordering::Greater => {
self.kick(&format!("Server outdated, Server uses Minecraft {CURRENT_MC_VERSION}, Protocol {CURRENT_MC_PROTOCOL}"));
}
}
}
}
+2 -3
View File
@@ -5,8 +5,7 @@ use pumpkin_entity::EntityId;
use pumpkin_protocol::{
client::play::{
Animation, CBlockUpdate, CEntityAnimation, CEntityVelocity, CHeadRot, CHurtAnimation,
CPlayerChatMessage, CUpdateEntityPos, CUpdateEntityPosRot,
CUpdateEntityRot, FilterType,
CPlayerChatMessage, CUpdateEntityPos, CUpdateEntityPosRot, CUpdateEntityRot, FilterType,
},
position::WorldPosition,
server::play::{
@@ -316,7 +315,7 @@ impl Client {
}
}
}
pub fn handle_player_action(&mut self, _server: &mut Server, player_action: SPlayerAction) {}
pub fn handle_player_action(&mut self, _server: &mut Server, _player_action: SPlayerAction) {}
pub fn handle_use_item_on(&mut self, server: &mut Server, use_item_on: SUseItemOn) {
let location = use_item_on.location;
+1 -1
View File
@@ -6,7 +6,7 @@ impl<'a> Command<'a> for StopCommand {
const NAME: &'static str = "stop";
const DESCRIPTION: &'static str = "Stops the server";
fn on_execute(sender: &mut super::CommandSender<'a>, command: String) {
fn on_execute(_sender: &mut super::CommandSender<'a>, _command: String) {
std::process::exit(0);
}
fn player_required() -> bool {
-1
View File
@@ -1,7 +1,6 @@
use std::str::FromStr;
use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::Float;
use pumpkin_entity::{entity_type::EntityType, Entity, EntityId};
use pumpkin_inventory::player::PlayerInventory;
use pumpkin_protocol::VarInt;
+2
View File
@@ -1,3 +1,5 @@
#![allow(clippy::await_holding_refcell_ref)]
use mio::net::TcpListener;
use mio::{Events, Interest, Poll, Token};
use std::io::{self};
+1 -1
View File
@@ -65,7 +65,7 @@ impl Packet {
buf.put_slice(bytes);
buf.put_u8(0);
buf.put_u8(0);
connection.write(&buf).unwrap();
let _ = connection.write(&buf).unwrap();
Ok(())
}