diff --git a/common/src/astar.rs b/common/src/astar.rs index 79a523c4d1..4f39310cd3 100644 --- a/common/src/astar.rs +++ b/common/src/astar.rs @@ -1,7 +1,7 @@ use crate::path::Path; use core::{ cmp::Ordering::{self, Equal}, - f32, fmt, + fmt, hash::{BuildHasher, Hash}, }; use hashbrown::{HashMap, HashSet}; diff --git a/common/src/comp/ori.rs b/common/src/comp/ori.rs index 822df99c9c..b06900a7cf 100644 --- a/common/src/comp/ori.rs +++ b/common/src/comp/ori.rs @@ -79,7 +79,7 @@ impl Ori { /// let ori1 = Ori::from(Dir::new(Vec3::unit_x())); /// let ori2 = Ori::default().rotated(roll_right).rotated(pitch_up); /// - /// assert!((ori1.look_dir().dot(*ori2.look_dir()) - 1.0).abs() <= std::f32::EPSILON); + /// assert!((ori1.look_dir().dot(*ori2.look_dir()) - 1.0).abs() <= f32::EPSILON); /// ``` #[must_use] pub fn rotated(self, q: Quaternion) -> Self { @@ -100,7 +100,7 @@ impl Ori { /// let ori1 = Ori::from(Dir::up()); /// let ori2 = Ori::default().prerotated(roll_right).prerotated(pitch_up); /// - /// assert!((ori1.look_dir().dot(*ori2.look_dir()) - 1.0).abs() <= std::f32::EPSILON); + /// assert!((ori1.look_dir().dot(*ori2.look_dir()) - 1.0).abs() <= f32::EPSILON); /// ``` #[must_use] pub fn prerotated(self, q: Quaternion) -> Self { @@ -280,17 +280,17 @@ impl Ori { /// let zenith = vek::Vec3::unit_z(); /// /// let rl = Ori::default().rolled_left(ang); - /// assert!((rl.up().angle_between(zenith) - ang).abs() <= std::f32::EPSILON); - /// assert!(rl.uprighted().up().angle_between(zenith) <= std::f32::EPSILON); + /// assert!((rl.up().angle_between(zenith) - ang).abs() <= f32::EPSILON); + /// assert!(rl.uprighted().up().angle_between(zenith) <= f32::EPSILON); /// /// let pd_rr = Ori::default().pitched_down(ang).rolled_right(ang); /// let pd_upr = pd_rr.uprighted(); /// - /// assert!((pd_upr.up().angle_between(zenith) - ang).abs() <= std::f32::EPSILON); + /// assert!((pd_upr.up().angle_between(zenith) - ang).abs() <= f32::EPSILON); /// /// let ang1 = pd_upr.rolled_right(ang).up().angle_between(zenith); /// let ang2 = pd_rr.up().angle_between(zenith); - /// assert!((ang1 - ang2).abs() <= std::f32::EPSILON); + /// assert!((ang1 - ang2).abs() <= f32::EPSILON); /// ``` #[must_use] pub fn uprighted(self) -> Self { self.look_dir().into() } diff --git a/common/src/recipe.rs b/common/src/recipe.rs index 5fe7ec4a24..5da4ba71dc 100644 --- a/common/src/recipe.rs +++ b/common/src/recipe.rs @@ -112,9 +112,9 @@ impl Recipe { /// ingredients needed, whose positions correspond to particular recipe /// inputs. If items are missing, return the missing items, and how many /// are missing. - pub fn inventory_contains_ingredients<'a>( + pub fn inventory_contains_ingredients( &self, - inv: &'a Inventory, + inv: &Inventory, ) -> Result, Vec<(&RecipeInput, u32)>> { // Hashmap tracking the quantity that needs to be removed from each slot (so // that it doesn't think a slot can provide more items than it contains) diff --git a/common/src/states/idle.rs b/common/src/states/idle.rs index 5359e0f6de..bfb8ddeb31 100644 --- a/common/src/states/idle.rs +++ b/common/src/states/idle.rs @@ -78,15 +78,15 @@ impl CharacterBehavior for Data { update } - fn talk(&self, data: &JoinData, _: &mut OutputEvents) -> StateUpdate { - let mut update = StateUpdate::from(data); - attempt_talk(data, &mut update); - update - } - fn stand(&self, data: &JoinData, _: &mut OutputEvents) -> StateUpdate { let mut update = StateUpdate::from(data); update.character = CharacterState::Idle(Data { is_sneaking: false }); update } + + fn talk(&self, data: &JoinData, _: &mut OutputEvents) -> StateUpdate { + let mut update = StateUpdate::from(data); + attempt_talk(data, &mut update); + update + } } diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 504bf8d5ff..67d8f920c6 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -476,7 +476,7 @@ fn swim_move( }; // Autoswim to stay afloat - let move_z = if submersion < 1.0 && data.inputs.move_z.abs() < std::f32::EPSILON { + let move_z = if submersion < 1.0 && data.inputs.move_z.abs() < f32::EPSILON { (submersion - 0.1).max(0.0) } else { data.inputs.move_z @@ -524,7 +524,7 @@ pub fn fly_move(data: &JoinData<'_>, update: &mut StateUpdate, efficiency: f32) Body::Ship(ship) if ship.can_fly() => { let regulate_density = |min: f32, max: f32, def: f32, rate: f32| -> Density { // Reset to default on no input - let change = if data.inputs.move_z.abs() > std::f32::EPSILON { + let change = if data.inputs.move_z.abs() > f32::EPSILON { -data.inputs.move_z } else { (def - data.density.0).max(-1.0).min(1.0) diff --git a/common/systems/src/phys.rs b/common/systems/src/phys.rs index 7a47c1400e..a46fefecdc 100644 --- a/common/systems/src/phys.rs +++ b/common/systems/src/phys.rs @@ -239,7 +239,7 @@ impl<'a> PhysicsData<'a> { // // Other advantage of early-return is that we don't // later divide by zero and return NaN - if len < std::f32::EPSILON * 10.0 { + if len < f32::EPSILON * 10.0 { Some((*p0, *p0)) } else { // Apply orientation to origins of prism. @@ -1897,7 +1897,7 @@ struct ColliderContext<'a> { /// Find pushback vector and collision_distance we assume between this /// colliders. fn projection_between(c0: ColliderContext, c1: ColliderContext) -> (Vec2, f32) { - const DIFF_THRESHOLD: f32 = std::f32::EPSILON; + const DIFF_THRESHOLD: f32 = f32::EPSILON; let our_radius = c0.previous_cache.neighborhood_radius; let their_radius = c1.previous_cache.neighborhood_radius; let collision_dist = our_radius + their_radius; diff --git a/server/src/settings/banlist.rs b/server/src/settings/banlist.rs index 086e471f9e..fa36808b39 100644 --- a/server/src/settings/banlist.rs +++ b/server/src/settings/banlist.rs @@ -377,11 +377,11 @@ mod v1 { // An unban record following a ban is valid if the role of the person doing the // unbanning is at least the privilege level of the person who did the ban. (BanAction::Unban(unban), Some(BanAction::Ban(ban))) => { - if unban.performed_by_role >= ban.performed_by_role() { - return Ok(()); + return if unban.performed_by_role >= ban.performed_by_role() { + Ok(()) } else { - return Err(BanErrorKind::PermissionDenied(BanKind::Unban)); - } + Err(BanErrorKind::PermissionDenied(BanKind::Unban)) + }; }, }; diff --git a/server/src/test_world.rs b/server/src/test_world.rs index 41f6681d38..ed9f74fdcc 100644 --- a/server/src/test_world.rs +++ b/server/src/test_world.rs @@ -36,7 +36,7 @@ impl IndexOwned { impl World { pub fn generate(_seed: u32) -> (Self, IndexOwned) { (Self, IndexOwned) } - pub fn tick(&self, dt: Duration) {} + pub fn tick(&self) {} #[inline(always)] pub const fn map_size_lg(&self) -> MapSizeLg { DEFAULT_WORLD_CHUNKS_LG } diff --git a/voxygen/benches/meshing_benchmark.rs b/voxygen/benches/meshing_benchmark.rs index a5345b960e..3670025a5a 100644 --- a/voxygen/benches/meshing_benchmark.rs +++ b/voxygen/benches/meshing_benchmark.rs @@ -59,10 +59,10 @@ pub fn criterion_benchmark(c: &mut Criterion) { // The region to actually mesh let min_z = volume .iter() - .fold(std::i32::MAX, |min, (_, chunk)| chunk.get_min_z().min(min)); + .fold(i32::MAX, |min, (_, chunk)| chunk.get_min_z().min(min)); let max_z = volume .iter() - .fold(std::i32::MIN, |max, (_, chunk)| chunk.get_max_z().max(max)); + .fold(i32::MIN, |max, (_, chunk)| chunk.get_max_z().max(max)); let aabb = Aabb { min: Vec3::from(aabr.min) + Vec3::unit_z() * (min_z - 1),