Fix: all clippy warns
This commit is contained in:
1 parent
a6d9ed216d
commit
de7b3aa2ea
21 files changed
+35
-53
No files matched your search
@@ -1,7 +1,6 @@
|
||||
use pumpkin_macros::packet;
|
||||
use serde::Serialize;
|
||||
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[packet(0x01)]
|
||||
pub struct CPluginMessage<'a> {
|
||||
|
||||
@@ -32,7 +32,7 @@ impl<'a> ClientPacket for CChunkData<'a> {
|
||||
data_buf.put_i16(block_count);
|
||||
//// Block states
|
||||
|
||||
let palette = chunk.into_iter().dedup().collect_vec();
|
||||
let palette = chunk.iter().dedup().collect_vec();
|
||||
// TODO: make dynamic block_size work
|
||||
// TODO: make direct block_size work
|
||||
enum PaletteType {
|
||||
@@ -63,7 +63,7 @@ impl<'a> ClientPacket for CChunkData<'a> {
|
||||
palette.iter().enumerate().for_each(|(i, id)| {
|
||||
palette_map.insert(*id, i);
|
||||
// Palette
|
||||
data_buf.put_var_int(&VarInt(**id as i32));
|
||||
data_buf.put_var_int(&VarInt(**id));
|
||||
});
|
||||
for block_clump in chunk.chunks(64 / block_size as usize) {
|
||||
let mut out_long: i64 = 0;
|
||||
@@ -109,7 +109,7 @@ impl<'a> ClientPacket for CChunkData<'a> {
|
||||
// Size
|
||||
buf.put_var_int(&VarInt(data_buf.buf().len() as i32));
|
||||
// Data
|
||||
buf.put_slice(&data_buf.buf());
|
||||
buf.put_slice(data_buf.buf());
|
||||
|
||||
// TODO: block entities
|
||||
buf.put_var_int(&VarInt(0));
|
||||
|
||||
@@ -21,6 +21,7 @@ pub struct CParticle<'a> {
|
||||
}
|
||||
|
||||
impl<'a> CParticle<'a> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
long_distance: bool,
|
||||
x: f64,
|
||||
|
||||
@@ -83,10 +83,10 @@ impl PacketEncoder {
|
||||
self.buf
|
||||
.copy_within(start_len..start_len + data_len, start_len + data_prefix_len);
|
||||
|
||||
let mut front = &mut self.buf[start_len..];
|
||||
let front = &mut self.buf[start_len..];
|
||||
|
||||
VarInt(packet_len as i32)
|
||||
.encode(&mut front)
|
||||
.encode(front.as_mut())
|
||||
.map_err(|_| PacketError::EncodeLength)?;
|
||||
// Zero for no compression on this packet.
|
||||
VarInt(0)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
use num_derive::FromPrimitive;
|
||||
use num_traits::FromPrimitive;
|
||||
use pumpkin_macros::packet;
|
||||
@@ -21,7 +20,7 @@ impl ServerPacket for SInteract {
|
||||
) -> Result<Self, crate::bytebuf::DeserializerError> {
|
||||
let entity_id = bytebuf.get_var_int();
|
||||
let typ = bytebuf.get_var_int();
|
||||
let action = ActionType::from_i32(typ.0 as i32).unwrap();
|
||||
let action = ActionType::from_i32(typ.0).unwrap();
|
||||
let target_position: Option<(f32, f32, f32)> = match action {
|
||||
ActionType::Interact => None,
|
||||
ActionType::Attack => None,
|
||||
|
||||
@@ -3,6 +3,7 @@ use pumpkin_macros::packet;
|
||||
use crate::{position::WorldPosition, VarInt};
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
#[packet(0x24)]
|
||||
pub struct SPlayerAction {
|
||||
status: VarInt,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use num_derive::FromPrimitive;
|
||||
use num_traits::FromPrimitive;
|
||||
use pumpkin_macros::packet;
|
||||
|
||||
use crate::{bytebuf::DeserializerError, ServerPacket, VarInt};
|
||||
|
||||
@@ -3,6 +3,7 @@ use pumpkin_macros::packet;
|
||||
use crate::slot::Slot;
|
||||
|
||||
#[derive(serde::Deserialize, Debug)]
|
||||
#[allow(dead_code)]
|
||||
#[packet(0x32)]
|
||||
pub struct SSetCreativeSlot {
|
||||
slot: i16,
|
||||
|
||||
@@ -6,6 +6,7 @@ use serde::{
|
||||
use crate::VarInt;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[allow(dead_code)]
|
||||
pub struct Slot {
|
||||
item_count: VarInt,
|
||||
item_id: Option<VarInt>,
|
||||
|
||||
Reference in new issue
Block a user