From 5efa8810909372063f69ad7d566eebf34bbcc32e Mon Sep 17 00:00:00 2001 From: Snowiiii Date: Thu, 28 Nov 2024 21:52:55 +0100 Subject: [PATCH] Fix: Clippy 1.83 --- pumpkin-core/src/math/position.rs | 2 +- pumpkin-core/src/text/mod.rs | 2 +- pumpkin-nbt/src/deserializer.rs | 6 +++--- pumpkin-nbt/src/serializer.rs | 8 ++++---- pumpkin-protocol/src/bytebuf/deserializer.rs | 2 +- pumpkin-protocol/src/bytebuf/packet_id.rs | 2 +- pumpkin-protocol/src/bytebuf/serializer.rs | 16 ++++++++-------- .../src/client/config/c_known_packs.rs | 2 +- .../src/client/config/c_registry_data.rs | 2 +- .../src/client/config/c_server_links.rs | 2 +- .../src/client/login/c_login_success.rs | 2 +- pumpkin-protocol/src/client/play/c_boss_event.rs | 2 +- pumpkin-protocol/src/client/play/c_chunk_data.rs | 2 +- .../src/client/play/c_command_suggestions.rs | 2 +- pumpkin-protocol/src/client/play/c_commands.rs | 6 +++--- .../src/client/play/c_player_info_update.rs | 2 +- .../src/client/play/c_server_links.rs | 2 +- .../src/client/play/c_sync_player_position.rs | 2 +- .../src/client/play/c_update_objectives.rs | 2 +- pumpkin-registry/src/recipe/read.rs | 2 +- pumpkin-registry/src/tags.rs | 2 +- pumpkin-world/src/chunk/anvil.rs | 5 +++-- .../src/world_gen/noise/density/blend.rs | 2 +- pumpkin-world/src/world_gen/noise/density/mod.rs | 2 +- .../src/world_gen/noise/density/unary.rs | 2 +- pumpkin-world/src/world_gen/noise/mod.rs | 2 +- pumpkin/src/command/args/arg_bounded_num.rs | 2 +- pumpkin/src/command/mod.rs | 2 +- pumpkin/src/command/tree.rs | 2 +- pumpkin/src/command/tree_format.rs | 6 +++--- pumpkin/src/proxy/velocity.rs | 7 +++---- pumpkin/src/server/key_store.rs | 2 +- pumpkin/src/server/mod.rs | 6 +++--- 33 files changed, 55 insertions(+), 55 deletions(-) diff --git a/pumpkin-core/src/math/position.rs b/pumpkin-core/src/math/position.rs index b71dbab4..83989064 100644 --- a/pumpkin-core/src/math/position.rs +++ b/pumpkin-core/src/math/position.rs @@ -46,7 +46,7 @@ impl<'de> Deserialize<'de> for WorldPosition { D: serde::Deserializer<'de>, { struct Visitor; - impl<'a> serde::de::Visitor<'a> for Visitor { + impl serde::de::Visitor<'_> for Visitor { type Value = WorldPosition; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { formatter.write_str("An i64 int") diff --git a/pumpkin-core/src/text/mod.rs b/pumpkin-core/src/text/mod.rs index 1d97c5b8..e10f868d 100644 --- a/pumpkin-core/src/text/mod.rs +++ b/pumpkin-core/src/text/mod.rs @@ -85,7 +85,7 @@ impl<'a> TextComponent<'a> { } } -impl<'a> serde::Serialize for TextComponent<'a> { +impl serde::Serialize for TextComponent<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/pumpkin-nbt/src/deserializer.rs b/pumpkin-nbt/src/deserializer.rs index 1ceb2d96..d461ff15 100644 --- a/pumpkin-nbt/src/deserializer.rs +++ b/pumpkin-nbt/src/deserializer.rs @@ -57,7 +57,7 @@ where T::deserialize(&mut deserializer) } -impl<'de, 'a, T: Buf> de::Deserializer<'de> for &'a mut Deserializer<'de, T> { +impl<'de, T: Buf> de::Deserializer<'de> for &mut Deserializer<'de, T> { type Error = Error; forward_to_deserialize_any!(i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 seq char str string bytes byte_buf tuple tuple_struct enum ignored_any unit unit_struct option newtype_struct); @@ -163,7 +163,7 @@ struct CompoundAccess<'a, 'de: 'a, T: Buf> { de: &'a mut Deserializer<'de, T>, } -impl<'de, 'a, T: Buf> MapAccess<'de> for CompoundAccess<'a, 'de, T> { +impl<'de, T: Buf> MapAccess<'de> for CompoundAccess<'_, 'de, T> { type Error = Error; fn next_key_seed(&mut self, seed: K) -> Result> @@ -194,7 +194,7 @@ struct ListAccess<'a, 'de: 'a, T: Buf> { list_type: u8, } -impl<'a, 'de, T: Buf> SeqAccess<'de> for ListAccess<'a, 'de, T> { +impl<'de, T: Buf> SeqAccess<'de> for ListAccess<'_, 'de, T> { type Error = Error; fn next_element_seed(&mut self, seed: E) -> Result> diff --git a/pumpkin-nbt/src/serializer.rs b/pumpkin-nbt/src/serializer.rs index bf0def35..5ab8913f 100644 --- a/pumpkin-nbt/src/serializer.rs +++ b/pumpkin-nbt/src/serializer.rs @@ -100,7 +100,7 @@ where Ok(()) } -impl<'a> ser::Serializer for &'a mut Serializer { +impl ser::Serializer for &mut Serializer { type Ok = (); type Error = Error; @@ -368,7 +368,7 @@ impl<'a> ser::Serializer for &'a mut Serializer { } } -impl<'a> ser::SerializeSeq for &'a mut Serializer { +impl ser::SerializeSeq for &mut Serializer { type Ok = (); type Error = Error; @@ -386,7 +386,7 @@ impl<'a> ser::SerializeSeq for &'a mut Serializer { } } -impl<'a> ser::SerializeStruct for &'a mut Serializer { +impl ser::SerializeStruct for &mut Serializer { type Ok = (); type Error = Error; @@ -404,7 +404,7 @@ impl<'a> ser::SerializeStruct for &'a mut Serializer { } } -impl<'a> ser::SerializeMap for &'a mut Serializer { +impl ser::SerializeMap for &mut Serializer { type Ok = (); type Error = Error; diff --git a/pumpkin-protocol/src/bytebuf/deserializer.rs b/pumpkin-protocol/src/bytebuf/deserializer.rs index 46208736..120fdaee 100644 --- a/pumpkin-protocol/src/bytebuf/deserializer.rs +++ b/pumpkin-protocol/src/bytebuf/deserializer.rs @@ -31,7 +31,7 @@ impl<'a> Deserializer<'a> { } } -impl<'a, 'de> de::Deserializer<'de> for Deserializer<'a> { +impl<'de> de::Deserializer<'de> for Deserializer<'_> { type Error = DeserializerError; fn deserialize_any(self, _visitor: V) -> Result diff --git a/pumpkin-protocol/src/bytebuf/packet_id.rs b/pumpkin-protocol/src/bytebuf/packet_id.rs index f2505b83..9f66e67d 100644 --- a/pumpkin-protocol/src/bytebuf/packet_id.rs +++ b/pumpkin-protocol/src/bytebuf/packet_id.rs @@ -8,7 +8,7 @@ use crate::{BitSet, ClientPacket, ServerPacket, VarInt, VarIntType, VarLong}; use super::{deserializer, serializer, ByteBuffer, DeserializerError}; -impl<'a> Serialize for BitSet<'a> { +impl Serialize for BitSet<'_> { fn serialize(&self, serializer: S) -> Result where S: Serializer, diff --git a/pumpkin-protocol/src/bytebuf/serializer.rs b/pumpkin-protocol/src/bytebuf/serializer.rs index 59985233..cb2f7866 100644 --- a/pumpkin-protocol/src/bytebuf/serializer.rs +++ b/pumpkin-protocol/src/bytebuf/serializer.rs @@ -56,7 +56,7 @@ impl ser::Error for SerializerError { // Structs are ignored // Iterables' values are written in order, but NO information (e.g. size) about the // iterable itself is written (list sizes should be a seperate field) -impl<'a> ser::Serializer for &'a mut Serializer { +impl ser::Serializer for &mut Serializer { type Ok = (); type Error = SerializerError; @@ -226,7 +226,7 @@ impl<'a> ser::Serializer for &'a mut Serializer { } } -impl<'a> ser::SerializeSeq for &'a mut Serializer { +impl ser::SerializeSeq for &mut Serializer { // Must match the `Ok` type of the serializer. type Ok = (); // Must match the `Error` type of the serializer. @@ -246,7 +246,7 @@ impl<'a> ser::SerializeSeq for &'a mut Serializer { } } -impl<'a> ser::SerializeTuple for &'a mut Serializer { +impl ser::SerializeTuple for &mut Serializer { type Ok = (); type Error = SerializerError; @@ -263,7 +263,7 @@ impl<'a> ser::SerializeTuple for &'a mut Serializer { } // Same thing but for tuple structs. -impl<'a> ser::SerializeTupleStruct for &'a mut Serializer { +impl ser::SerializeTupleStruct for &mut Serializer { type Ok = (); type Error = SerializerError; @@ -288,7 +288,7 @@ impl<'a> ser::SerializeTupleStruct for &'a mut Serializer { // // So the `end` method in this impl is responsible for closing both the `]` and // the `}`. -impl<'a> ser::SerializeTupleVariant for &'a mut Serializer { +impl ser::SerializeTupleVariant for &mut Serializer { type Ok = (); type Error = SerializerError; @@ -312,7 +312,7 @@ impl<'a> ser::SerializeTupleVariant for &'a mut Serializer { // `serialize_entry` method allows serializers to optimize for the case where // key and value are both available simultaneously. In JSON it doesn't make a // difference so the default behavior for `serialize_entry` is fine. -impl<'a> ser::SerializeMap for &'a mut Serializer { +impl ser::SerializeMap for &mut Serializer { type Ok = (); type Error = SerializerError; @@ -348,7 +348,7 @@ impl<'a> ser::SerializeMap for &'a mut Serializer { // Structs are like maps in which the keys are constrained to be compile-time // constant strings. -impl<'a> ser::SerializeStruct for &'a mut Serializer { +impl ser::SerializeStruct for &mut Serializer { type Ok = (); type Error = SerializerError; @@ -371,7 +371,7 @@ impl<'a> ser::SerializeStruct for &'a mut Serializer { // Similar to `SerializeTupleVariant`, here the `end` method is responsible for // closing both of the curly braces opened by `serialize_struct_variant`. -impl<'a> ser::SerializeStructVariant for &'a mut Serializer { +impl ser::SerializeStructVariant for &mut Serializer { type Ok = (); type Error = SerializerError; diff --git a/pumpkin-protocol/src/client/config/c_known_packs.rs b/pumpkin-protocol/src/client/config/c_known_packs.rs index 89f7d7e6..80b37580 100644 --- a/pumpkin-protocol/src/client/config/c_known_packs.rs +++ b/pumpkin-protocol/src/client/config/c_known_packs.rs @@ -13,7 +13,7 @@ impl<'a> CKnownPacks<'a> { } } -impl<'a> ClientPacket for CKnownPacks<'a> { +impl ClientPacket for CKnownPacks<'_> { fn write(&self, bytebuf: &mut ByteBuffer) { bytebuf.put_list::(self.known_packs, |p, v| { p.put_string(v.namespace); diff --git a/pumpkin-protocol/src/client/config/c_registry_data.rs b/pumpkin-protocol/src/client/config/c_registry_data.rs index ed6dc4e2..d346ca45 100644 --- a/pumpkin-protocol/src/client/config/c_registry_data.rs +++ b/pumpkin-protocol/src/client/config/c_registry_data.rs @@ -23,7 +23,7 @@ pub struct RegistryEntry<'a> { pub data: BytesMut, } -impl<'a> ClientPacket for CRegistryData<'a> { +impl ClientPacket for CRegistryData<'_> { fn write(&self, bytebuf: &mut ByteBuffer) { bytebuf.put_string(self.registry_id); bytebuf.put_list::(self.entries, |p, v| { diff --git a/pumpkin-protocol/src/client/config/c_server_links.rs b/pumpkin-protocol/src/client/config/c_server_links.rs index 41ed4d00..b4150d8e 100644 --- a/pumpkin-protocol/src/client/config/c_server_links.rs +++ b/pumpkin-protocol/src/client/config/c_server_links.rs @@ -21,7 +21,7 @@ pub enum Label<'a> { TextComponent(TextComponent<'a>), } -impl<'a> Serialize for Label<'a> { +impl Serialize for Label<'_> { fn serialize(&self, serializer: S) -> Result where S: Serializer, diff --git a/pumpkin-protocol/src/client/login/c_login_success.rs b/pumpkin-protocol/src/client/login/c_login_success.rs index d92fdcf7..462fcce5 100644 --- a/pumpkin-protocol/src/client/login/c_login_success.rs +++ b/pumpkin-protocol/src/client/login/c_login_success.rs @@ -19,7 +19,7 @@ impl<'a> CLoginSuccess<'a> { } } -impl<'a> ClientPacket for CLoginSuccess<'a> { +impl ClientPacket for CLoginSuccess<'_> { fn write(&self, bytebuf: &mut ByteBuffer) { bytebuf.put_uuid(self.uuid); bytebuf.put_string(self.username); diff --git a/pumpkin-protocol/src/client/play/c_boss_event.rs b/pumpkin-protocol/src/client/play/c_boss_event.rs index 18938224..34452654 100644 --- a/pumpkin-protocol/src/client/play/c_boss_event.rs +++ b/pumpkin-protocol/src/client/play/c_boss_event.rs @@ -15,7 +15,7 @@ impl<'a> CBossEvent<'a> { } } -impl<'a> ClientPacket for CBossEvent<'a> { +impl ClientPacket for CBossEvent<'_> { fn write(&self, bytebuf: &mut ByteBuffer) { bytebuf.put_uuid(&self.uuid); let action = &self.action; diff --git a/pumpkin-protocol/src/client/play/c_chunk_data.rs b/pumpkin-protocol/src/client/play/c_chunk_data.rs index 803eef28..cd98d1cf 100644 --- a/pumpkin-protocol/src/client/play/c_chunk_data.rs +++ b/pumpkin-protocol/src/client/play/c_chunk_data.rs @@ -7,7 +7,7 @@ use pumpkin_world::{chunk::ChunkData, DIRECT_PALETTE_BITS}; #[client_packet("play:level_chunk_with_light")] pub struct CChunkData<'a>(pub &'a ChunkData); -impl<'a> ClientPacket for CChunkData<'a> { +impl ClientPacket for CChunkData<'_> { fn write(&self, buf: &mut crate::bytebuf::ByteBuffer) { // Chunk X buf.put_i32(self.0.position.x); diff --git a/pumpkin-protocol/src/client/play/c_command_suggestions.rs b/pumpkin-protocol/src/client/play/c_command_suggestions.rs index 0cd1c9b8..b3dd4c17 100644 --- a/pumpkin-protocol/src/client/play/c_command_suggestions.rs +++ b/pumpkin-protocol/src/client/play/c_command_suggestions.rs @@ -27,7 +27,7 @@ impl<'a> CCommandSuggestions<'a> { } } -impl<'a> ClientPacket for CCommandSuggestions<'a> { +impl ClientPacket for CCommandSuggestions<'_> { fn write(&self, bytebuf: &mut crate::bytebuf::ByteBuffer) { bytebuf.put_var_int(&self.id); bytebuf.put_var_int(&self.start); diff --git a/pumpkin-protocol/src/client/play/c_commands.rs b/pumpkin-protocol/src/client/play/c_commands.rs index 4d366bcb..32dc71df 100644 --- a/pumpkin-protocol/src/client/play/c_commands.rs +++ b/pumpkin-protocol/src/client/play/c_commands.rs @@ -17,7 +17,7 @@ impl<'a> CCommands<'a> { } } -impl<'a> ClientPacket for CCommands<'a> { +impl ClientPacket for CCommands<'_> { fn write(&self, bytebuf: &mut ByteBuffer) { bytebuf.put_list(&self.nodes, |bytebuf, node: &ProtoNode| { node.write_to(bytebuf) @@ -46,7 +46,7 @@ pub enum ProtoNodeType<'a> { }, } -impl<'a> ProtoNode<'a> { +impl ProtoNode<'_> { const FLAG_IS_EXECUTABLE: u8 = 4; const FLAG_HAS_REDIRECT: u8 = 8; const FLAG_HAS_SUGGESTION_TYPE: u8 = 16; @@ -181,7 +181,7 @@ pub enum ProtoCmdArgParser<'a> { Uuid, } -impl<'a> ProtoCmdArgParser<'a> { +impl ProtoCmdArgParser<'_> { pub const ENTITY_FLAG_ONLY_SINGLE: u8 = 1; pub const ENTITY_FLAG_PLAYERS_ONLY: u8 = 2; diff --git a/pumpkin-protocol/src/client/play/c_player_info_update.rs b/pumpkin-protocol/src/client/play/c_player_info_update.rs index e13c4c88..09fbff94 100644 --- a/pumpkin-protocol/src/client/play/c_player_info_update.rs +++ b/pumpkin-protocol/src/client/play/c_player_info_update.rs @@ -21,7 +21,7 @@ impl<'a> CPlayerInfoUpdate<'a> { } } -impl<'a> ClientPacket for CPlayerInfoUpdate<'a> { +impl ClientPacket for CPlayerInfoUpdate<'_> { fn write(&self, bytebuf: &mut ByteBuffer) { bytebuf.put_i8(self.actions); bytebuf.put_list::(self.players, |p, v| { diff --git a/pumpkin-protocol/src/client/play/c_server_links.rs b/pumpkin-protocol/src/client/play/c_server_links.rs index fc813e46..7619a0c6 100644 --- a/pumpkin-protocol/src/client/play/c_server_links.rs +++ b/pumpkin-protocol/src/client/play/c_server_links.rs @@ -21,7 +21,7 @@ pub enum Label<'a> { TextComponent(TextComponent<'a>), } -impl<'a> Serialize for Label<'a> { +impl Serialize for Label<'_> { fn serialize(&self, serializer: S) -> Result where S: Serializer, diff --git a/pumpkin-protocol/src/client/play/c_sync_player_position.rs b/pumpkin-protocol/src/client/play/c_sync_player_position.rs index df136a43..5e163df7 100644 --- a/pumpkin-protocol/src/client/play/c_sync_player_position.rs +++ b/pumpkin-protocol/src/client/play/c_sync_player_position.rs @@ -41,7 +41,7 @@ impl<'a> CSyncPlayerPosition<'a> { } } -impl<'a> ClientPacket for CSyncPlayerPosition<'a> { +impl ClientPacket for CSyncPlayerPosition<'_> { fn write(&self, bytebuf: &mut crate::bytebuf::ByteBuffer) { bytebuf.put_var_int(&self.teleport_id); bytebuf.put_f64(self.x); diff --git a/pumpkin-protocol/src/client/play/c_update_objectives.rs b/pumpkin-protocol/src/client/play/c_update_objectives.rs index 11450436..e5ae2e2d 100644 --- a/pumpkin-protocol/src/client/play/c_update_objectives.rs +++ b/pumpkin-protocol/src/client/play/c_update_objectives.rs @@ -30,7 +30,7 @@ impl<'a> CUpdateObjectives<'a> { } } -impl<'a> ClientPacket for CUpdateObjectives<'a> { +impl ClientPacket for CUpdateObjectives<'_> { fn write(&self, bytebuf: &mut crate::bytebuf::ByteBuffer) { bytebuf.put_string(self.objective_name); bytebuf.put_u8(self.mode); diff --git a/pumpkin-registry/src/recipe/read.rs b/pumpkin-registry/src/recipe/read.rs index 2f3e0867..44bd1023 100644 --- a/pumpkin-registry/src/recipe/read.rs +++ b/pumpkin-registry/src/recipe/read.rs @@ -95,7 +95,7 @@ pub mod ingredients { } struct IngredientTypeVisitor; - impl<'de> Visitor<'de> for IngredientTypeVisitor { + impl Visitor<'_> for IngredientTypeVisitor { type Value = IngredientType; fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { write!(formatter, "valid item type") diff --git a/pumpkin-registry/src/tags.rs b/pumpkin-registry/src/tags.rs index 80ca90d3..e5a7b255 100644 --- a/pumpkin-registry/src/tags.rs +++ b/pumpkin-registry/src/tags.rs @@ -82,7 +82,7 @@ impl<'de> Deserialize<'de> for TagType { D: Deserializer<'de>, { struct TagVisitor; - impl<'de> Visitor<'de> for TagVisitor { + impl Visitor<'_> for TagVisitor { type Value = TagType; fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { write!(formatter, "valid tag") diff --git a/pumpkin-world/src/chunk/anvil.rs b/pumpkin-world/src/chunk/anvil.rs index 7f9ae006..6d13e960 100644 --- a/pumpkin-world/src/chunk/anvil.rs +++ b/pumpkin-world/src/chunk/anvil.rs @@ -145,8 +145,9 @@ impl ChunkReader for AnvilChunkReader { // TODO: check checksum to make sure chunk is not corrupted let header = file_buf.drain(0..5).collect_vec(); - let compression = Compression::from_byte(header[4]) - .ok_or_else(|| ChunkReadingError::Compression(CompressionError::UnknownCompression))?; + let compression = Compression::from_byte(header[4]).ok_or( + ChunkReadingError::Compression(CompressionError::UnknownCompression), + )?; let size = u32::from_be_bytes(header[..4].try_into().unwrap()); diff --git a/pumpkin-world/src/world_gen/noise/density/blend.rs b/pumpkin-world/src/world_gen/noise/density/blend.rs index 952efc81..493cb035 100644 --- a/pumpkin-world/src/world_gen/noise/density/blend.rs +++ b/pumpkin-world/src/world_gen/noise/density/blend.rs @@ -66,7 +66,7 @@ impl<'a> BlendDensityFunction<'a> { } } -impl<'a> BlendDensityFunction<'a> { +impl BlendDensityFunction<'_> { fn apply_density(&self, pos: &NoisePos, density: f64) -> f64 { pos.get_blender().apply_blend_density(pos, density) } diff --git a/pumpkin-world/src/world_gen/noise/density/mod.rs b/pumpkin-world/src/world_gen/noise/density/mod.rs index a2edc99b..c2ed0f46 100644 --- a/pumpkin-world/src/world_gen/noise/density/mod.rs +++ b/pumpkin-world/src/world_gen/noise/density/mod.rs @@ -875,7 +875,7 @@ pub struct Unused<'a> { _x: &'a str, } -impl<'a> NoisePosImpl for Unused<'a> { +impl NoisePosImpl for Unused<'_> { fn x(&self) -> i32 { todo!() } diff --git a/pumpkin-world/src/world_gen/noise/density/unary.rs b/pumpkin-world/src/world_gen/noise/density/unary.rs index 143ab1a2..578e1b61 100644 --- a/pumpkin-world/src/world_gen/noise/density/unary.rs +++ b/pumpkin-world/src/world_gen/noise/density/unary.rs @@ -65,7 +65,7 @@ pub struct UnaryFunction<'a> { } impl<'a> UnaryFunction<'a> { - pub(crate) fn create(action: UnaryType, input: Arc>) -> UnaryFunction { + pub(crate) fn create(action: UnaryType, input: Arc>) -> UnaryFunction<'a> { let base_min = input.min(); let new_min = Self::internal_apply(&action, base_min); let new_max = Self::internal_apply(&action, input.max()); diff --git a/pumpkin-world/src/world_gen/noise/mod.rs b/pumpkin-world/src/world_gen/noise/mod.rs index 72d00920..8b72fcdf 100644 --- a/pumpkin-world/src/world_gen/noise/mod.rs +++ b/pumpkin-world/src/world_gen/noise/mod.rs @@ -70,7 +70,7 @@ pub struct BuiltInNoiseParams<'a> { nether_state_selector: DoublePerlinNoiseParameters<'a>, } -impl<'a> BuiltInNoiseParams<'a> { +impl BuiltInNoiseParams<'_> { pub fn new() -> Self { Self { temperature: DoublePerlinNoiseParameters::new( diff --git a/pumpkin/src/command/args/arg_bounded_num.rs b/pumpkin/src/command/args/arg_bounded_num.rs index fb95b307..4a9f718b 100644 --- a/pumpkin/src/command/args/arg_bounded_num.rs +++ b/pumpkin/src/command/args/arg_bounded_num.rs @@ -57,7 +57,7 @@ where } } -impl<'a, T: ToFromNumber> FindArg<'a> for BoundedNumArgumentConsumer { +impl FindArg<'_> for BoundedNumArgumentConsumer { type Data = Result; fn find_arg(args: &super::ConsumedArgs, name: &str) -> Result { diff --git a/pumpkin/src/command/mod.rs b/pumpkin/src/command/mod.rs index 514d9a9b..09c85c81 100644 --- a/pumpkin/src/command/mod.rs +++ b/pumpkin/src/command/mod.rs @@ -32,7 +32,7 @@ pub enum CommandSender<'a> { Player(Arc), } -impl<'a> fmt::Display for CommandSender<'a> { +impl fmt::Display for CommandSender<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, diff --git a/pumpkin/src/command/tree.rs b/pumpkin/src/command/tree.rs index 5db18fa3..06d9c0e5 100644 --- a/pumpkin/src/command/tree.rs +++ b/pumpkin/src/command/tree.rs @@ -81,7 +81,7 @@ struct TraverseAllPathsIter<'a> { todo: VecDeque<(usize, usize)>, } -impl<'a> Iterator for TraverseAllPathsIter<'a> { +impl Iterator for TraverseAllPathsIter<'_> { type Item = Vec; fn next(&mut self) -> Option { diff --git a/pumpkin/src/command/tree_format.rs b/pumpkin/src/command/tree_format.rs index 70c575d4..5e57a106 100644 --- a/pumpkin/src/command/tree_format.rs +++ b/pumpkin/src/command/tree_format.rs @@ -7,7 +7,7 @@ trait IsVisible { fn is_visible(&self) -> bool; } -impl<'a> IsVisible for Node<'a> { +impl IsVisible for Node<'_> { fn is_visible(&self) -> bool { matches!( self.node_type, @@ -16,7 +16,7 @@ impl<'a> IsVisible for Node<'a> { } } -impl<'a> Display for Node<'a> { +impl Display for Node<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self.node_type { NodeType::Literal { string } => { @@ -50,7 +50,7 @@ fn flatten_require_nodes(nodes: &[Node], children: &[usize]) -> Vec { new_children } -impl<'a> Display for CommandTree<'a> { +impl Display for CommandTree<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.write_char('/')?; f.write_str(self.names[0])?; diff --git a/pumpkin/src/proxy/velocity.rs b/pumpkin/src/proxy/velocity.rs index f87ee925..cf4bcfc1 100644 --- a/pumpkin/src/proxy/velocity.rs +++ b/pumpkin/src/proxy/velocity.rs @@ -1,3 +1,6 @@ +/// Proxy implementation for Velocity by `PaperMC` +/// Sadly `PaperMC` does not care about 3th Parties providing support for Velocity, There is no documentation. +/// I had to understand the Code logic by looking at `PaperMC`'s Velocity implementation: use std::net::{IpAddr, SocketAddr}; use bytes::{BufMut, BytesMut}; @@ -13,10 +16,6 @@ use thiserror::Error; use crate::client::{authentication::GameProfile, Client}; -/// Proxy implementation for Velocity by `PaperMC` -/// Sadly `PaperMC` does not care about 3th Parties providing support for Velocity, There is no documentation. -/// I had to understand the Code logic by looking at `PaperMC`'s Velocity implementation: - type HmacSha256 = Hmac; const MAX_SUPPORTED_FORWARDING_VERSION: u8 = 4; diff --git a/pumpkin/src/server/key_store.rs b/pumpkin/src/server/key_store.rs index 81ad69cb..daf7f734 100644 --- a/pumpkin/src/server/key_store.rs +++ b/pumpkin/src/server/key_store.rs @@ -41,7 +41,7 @@ impl KeyStore { server_id: &'a str, verification_token: &'a [u8; 4], should_authenticate: bool, - ) -> CEncryptionRequest<'_> { + ) -> CEncryptionRequest<'a> { CEncryptionRequest::new( server_id, &self.public_key_der, diff --git a/pumpkin/src/server/mod.rs b/pumpkin/src/server/mod.rs index 4f7ab1eb..db295cf4 100644 --- a/pumpkin/src/server/mod.rs +++ b/pumpkin/src/server/mod.rs @@ -112,7 +112,7 @@ impl Server { } /// Adds a new player to the server. - + /// /// This function takes an `Arc` representing the connected client and performs the following actions: /// /// 1. Generates a new entity ID for the player. @@ -125,7 +125,7 @@ impl Server { /// # Arguments /// /// * `client`: An `Arc` representing the connected client. - + /// /// # Returns /// /// A tuple containing: @@ -301,7 +301,7 @@ impl Server { &'a self, verification_token: &'a [u8; 4], should_authenticate: bool, - ) -> CEncryptionRequest<'_> { + ) -> CEncryptionRequest<'a> { self.key_store .encryption_request("", verification_token, should_authenticate) }