From 8a1e1b7bb93373e85432ce4211b6ede4eae79409 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 20 Apr 2024 04:03:03 +0000 Subject: clippy --- azalea-brigadier/src/context/command_context_builder.rs | 4 ++-- azalea-buf/src/write.rs | 4 ++-- azalea-client/src/packet_handling/game.rs | 2 +- azalea-client/src/task_pool.rs | 4 ++-- azalea-physics/src/collision/shape.rs | 2 +- azalea-physics/src/collision/world_collisions.rs | 2 -- azalea/benches/physics.rs | 14 ++------------ 7 files changed, 10 insertions(+), 22 deletions(-) diff --git a/azalea-brigadier/src/context/command_context_builder.rs b/azalea-brigadier/src/context/command_context_builder.rs index 75295825..95e1b5d8 100755 --- a/azalea-brigadier/src/context/command_context_builder.rs +++ b/azalea-brigadier/src/context/command_context_builder.rs @@ -63,7 +63,7 @@ impl<'a, S> CommandContextBuilder<'a, S> { } pub fn with_command(&mut self, command: &Command) -> &Self { - self.command = command.clone(); + self.command.clone_from(command); self } pub fn with_child(&mut self, child: Rc>) -> &Self { @@ -80,7 +80,7 @@ impl<'a, S> CommandContextBuilder<'a, S> { range, }); self.range = StringRange::encompassing(&self.range, &range); - self.modifier = node.read().modifier.clone(); + self.modifier.clone_from(&node.read().modifier); self.forks = node.read().forks; self } diff --git a/azalea-buf/src/write.rs b/azalea-buf/src/write.rs index c8d1f990..7b1fb331 100755 --- a/azalea-buf/src/write.rs +++ b/azalea-buf/src/write.rs @@ -41,7 +41,7 @@ impl McBufVarWritable for i32 { } while value != 0 { buffer[0] = (value & 0b0111_1111) as u8; - value = (value >> 7) & (i32::max_value() >> 6); + value = (value >> 7) & (i32::MAX >> 6); if value != 0 { buffer[0] |= 0b1000_0000; } @@ -137,7 +137,7 @@ impl McBufVarWritable for i64 { } while value != 0 { buffer[0] = (value & 0b0111_1111) as u8; - value = (value >> 7) & (i64::max_value() >> 6); + value = (value >> 7) & (i64::MAX >> 6); if value != 0 { buffer[0] |= 0b1000_0000; } diff --git a/azalea-client/src/packet_handling/game.rs b/azalea-client/src/packet_handling/game.rs index 30b736c0..1c913ba5 100644 --- a/azalea-client/src/packet_handling/game.rs +++ b/azalea-client/src/packet_handling/game.rs @@ -557,7 +557,7 @@ pub fn process_packet_events(ecs: &mut World) { info.latency = updated_info.latency; } if p.actions.update_display_name { - info.display_name = updated_info.display_name.clone(); + info.display_name.clone_from(&updated_info.display_name); } update_player_events.send(UpdatePlayerEvent { entity: player_entity, diff --git a/azalea-client/src/task_pool.rs b/azalea-client/src/task_pool.rs index da1de607..d4963cd5 100644 --- a/azalea-client/src/task_pool.rs +++ b/azalea-client/src/task_pool.rs @@ -58,7 +58,7 @@ impl Default for TaskPoolOptions { TaskPoolOptions { // By default, use however many cores are available on the system min_total_threads: 1, - max_total_threads: std::usize::MAX, + max_total_threads: usize::MAX, // Use 25% of cores for IO, at least 1, no more than 4 io: TaskPoolThreadAssignmentPolicy { @@ -77,7 +77,7 @@ impl Default for TaskPoolOptions { // Use all remaining cores for compute (at least 1) compute: TaskPoolThreadAssignmentPolicy { min_threads: 1, - max_threads: std::usize::MAX, + max_threads: usize::MAX, percent: 1.0, // This 1.0 here means "whatever is left over" }, } diff --git a/azalea-physics/src/collision/shape.rs b/azalea-physics/src/collision/shape.rs index 710074de..edcfbf24 100755 --- a/azalea-physics/src/collision/shape.rs +++ b/azalea-physics/src/collision/shape.rs @@ -323,7 +323,7 @@ impl Shapes { coords: coords1.to_vec(), } } else { - IndexMerger::new_indirect(&coords1, &coords2, var3, var4) + IndexMerger::new_indirect(coords1, coords2, var3, var4) } } } diff --git a/azalea-physics/src/collision/world_collisions.rs b/azalea-physics/src/collision/world_collisions.rs index 4a3c2c3b..9d25e988 100644 --- a/azalea-physics/src/collision/world_collisions.rs +++ b/azalea-physics/src/collision/world_collisions.rs @@ -85,7 +85,6 @@ pub struct BlockCollisionsState<'a> { pub aabb: AABB, pub entity_shape: VoxelShape, pub cursor: Cursor3d, - pub only_suffocating_blocks: bool, cached_sections: Vec<(ChunkSectionPos, azalea_world::Section)>, cached_block_shapes: Vec<(BlockState, &'static VoxelShape)>, @@ -112,7 +111,6 @@ impl<'a> BlockCollisionsState<'a> { aabb, entity_shape: VoxelShape::from(aabb), cursor, - only_suffocating_blocks: false, cached_sections: Vec::new(), cached_block_shapes: Vec::new(), diff --git a/azalea/benches/physics.rs b/azalea/benches/physics.rs index 0d4a3f2f..146b3018 100644 --- a/azalea/benches/physics.rs +++ b/azalea/benches/physics.rs @@ -1,20 +1,10 @@ -use std::{hint::black_box, sync::Arc, time::Duration}; - use azalea::{ - pathfinder::{ - astar::{self, a_star}, - goals::{BlockPosGoal, Goal}, - mining::MiningCache, - simulation::{SimulatedPlayerBundle, Simulation, SimulationSet}, - world::CachedWorld, - }, - BlockPos, Vec3, + pathfinder::simulation::{SimulatedPlayerBundle, SimulationSet}, + Vec3, }; use azalea_core::position::{ChunkBlockPos, ChunkPos}; -use azalea_inventory::Menu; use azalea_world::{Chunk, ChunkStorage, PartialChunkStorage}; use criterion::{criterion_group, criterion_main, Bencher, Criterion}; -use parking_lot::RwLock; #[allow(dead_code)] fn generate_world(partial_chunks: &mut PartialChunkStorage, size: u32) -> ChunkStorage { -- cgit v1.2.3