Skip to content

Commit

Permalink
Fix: Clippy 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Nov 28, 2024
1 parent 267225c commit 5efa881
Show file tree
Hide file tree
Showing 33 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion pumpkin-core/src/math/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-core/src/text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<'a> TextComponent<'a> {
}
}

impl<'a> serde::Serialize for TextComponent<'a> {
impl serde::Serialize for TextComponent<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand Down
6 changes: 3 additions & 3 deletions pumpkin-nbt/src/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<K>(&mut self, seed: K) -> Result<Option<K::Value>>
Expand Down Expand Up @@ -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<E>(&mut self, seed: E) -> Result<Option<E::Value>>
Expand Down
8 changes: 4 additions & 4 deletions pumpkin-nbt/src/serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/bytebuf/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<V>(self, _visitor: V) -> Result<V::Value, Self::Error>
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/bytebuf/packet_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
16 changes: 8 additions & 8 deletions pumpkin-protocol/src/bytebuf/serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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.
Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/config/c_known_packs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<KnownPack>(self.known_packs, |p, v| {
p.put_string(v.namespace);
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/config/c_registry_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<RegistryEntry>(self.entries, |p, v| {
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/config/c_server_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum Label<'a> {
TextComponent(TextComponent<'a>),
}

impl<'a> Serialize for Label<'a> {
impl Serialize for Label<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/login/c_login_success.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_boss_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_chunk_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_command_suggestions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions pumpkin-protocol/src/client/play/c_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_player_info_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Player>(self.players, |p, v| {
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_server_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum Label<'a> {
TextComponent(TextComponent<'a>),
}

impl<'a> Serialize for Label<'a> {
impl Serialize for Label<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_sync_player_position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/client/play/c_update_objectives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-registry/src/recipe/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-registry/src/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions pumpkin-world/src/chunk/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion pumpkin-world/src/world_gen/noise/density/blend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-world/src/world_gen/noise/density/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()
}
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-world/src/world_gen/noise/density/unary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct UnaryFunction<'a> {
}

impl<'a> UnaryFunction<'a> {
pub(crate) fn create(action: UnaryType, input: Arc<DensityFunction<'a>>) -> UnaryFunction {
pub(crate) fn create(action: UnaryType, input: Arc<DensityFunction<'a>>) -> 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());
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-world/src/world_gen/noise/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/command/args/arg_bounded_num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ where
}
}

impl<'a, T: ToFromNumber> FindArg<'a> for BoundedNumArgumentConsumer<T> {
impl<T: ToFromNumber> FindArg<'_> for BoundedNumArgumentConsumer<T> {
type Data = Result<T, NotInBounds>;

fn find_arg(args: &super::ConsumedArgs, name: &str) -> Result<Self::Data, CommandError> {
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum CommandSender<'a> {
Player(Arc<Player>),
}

impl<'a> fmt::Display for CommandSender<'a> {
impl fmt::Display for CommandSender<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/command/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct TraverseAllPathsIter<'a> {
todo: VecDeque<(usize, usize)>,
}

impl<'a> Iterator for TraverseAllPathsIter<'a> {
impl Iterator for TraverseAllPathsIter<'_> {
type Item = Vec<usize>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
Loading

0 comments on commit 5efa881

Please sign in to comment.