diff --git a/all-is-cubes-base/src/lib.rs b/all-is-cubes-base/src/lib.rs index 957c900db..29e817adf 100644 --- a/all-is-cubes-base/src/lib.rs +++ b/all-is-cubes-base/src/lib.rs @@ -10,7 +10,7 @@ not(any(test, feature = "arbitrary")), warn(clippy::std_instead_of_core, clippy::std_instead_of_alloc) )] -#![cfg_attr(not(feature = "std"), expect(clippy::arc_with_non_send_sync))] +#![cfg_attr(not(feature = "std"), allow(clippy::arc_with_non_send_sync))] #![warn(clippy::missing_inline_in_public_items)] #[cfg(any(feature = "std", test))] diff --git a/all-is-cubes-base/src/math.rs b/all-is-cubes-base/src/math.rs index 511c26495..09414f489 100644 --- a/all-is-cubes-base/src/math.rs +++ b/all-is-cubes-base/src/math.rs @@ -117,18 +117,18 @@ macro_rules! notnan { }; } -#[cfg(not(feature = "std"))] +#[cfg(not(any(feature = "std", test)))] +#[allow(dead_code, reason = "unclear why this warns even though it is needed")] /// Identical to [`num_traits::Euclid`] except that its signatures are compatible with /// `std` versions. /// /// Note: this code is duplicated between `all-is-cubes` and /// `all-is-cubes-base` so that it doesn't need to be public. pub(crate) trait Euclid { - #[allow(dead_code)] fn div_euclid(self, rhs: Self) -> Self; fn rem_euclid(self, rhs: Self) -> Self; } -#[cfg(not(feature = "std"))] +#[cfg(not(any(feature = "std", test)))] impl Euclid for T { fn div_euclid(self, rhs: Self) -> Self { ::div_euclid(&self, &rhs) diff --git a/all-is-cubes-base/src/raycast.rs b/all-is-cubes-base/src/raycast.rs index 316167b31..b073b762b 100644 --- a/all-is-cubes-base/src/raycast.rs +++ b/all-is-cubes-base/src/raycast.rs @@ -1,12 +1,12 @@ use euclid::Vector3D; /// Acts as polyfill for float methods -#[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[cfg(not(any(feature = "std", test)))] +#[allow(unused_imports, reason = "unclear why this warns even though it is needed")] use num_traits::float::Float as _; -#[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[cfg(not(any(feature = "std", test)))] +#[allow(unused_imports, reason = "unclear why this warns even though it is needed")] use crate::math::Euclid as _; use crate::math::{ Axis, Cube, CubeFace, Face7, FreeCoordinate, FreePoint, FreeVector, GridAab, GridCoordinate, diff --git a/all-is-cubes-desktop/src/bin/all-is-cubes/command_options.rs b/all-is-cubes-desktop/src/bin/all-is-cubes/command_options.rs index 6a2216c10..1d7dea518 100644 --- a/all-is-cubes-desktop/src/bin/all-is-cubes/command_options.rs +++ b/all-is-cubes-desktop/src/bin/all-is-cubes/command_options.rs @@ -388,6 +388,7 @@ pub(crate) fn parse_universe_source( mod tests { use super::*; use all_is_cubes::euclid::size3; + #[allow(unused_imports)] use clap::error::{ContextValue, ErrorKind}; fn parse(args: &[&str]) -> clap::error::Result { diff --git a/all-is-cubes/src/behavior.rs b/all-is-cubes/src/behavior.rs index cb50713ec..2c9e2cb94 100644 --- a/all-is-cubes/src/behavior.rs +++ b/all-is-cubes/src/behavior.rs @@ -334,7 +334,11 @@ struct Key(u64); impl Key { fn new() -> Self { - #![allow(clippy::useless_conversion)] // useless on pointer_width=64 + #![allow( + clippy::useless_conversion, + clippy::unnecessary_fallible_conversions, + reason = "depends on pointer width and atomic support" + )] use core::sync::atomic::{self, Ordering}; diff --git a/all-is-cubes/src/camera/graphics_options.rs b/all-is-cubes/src/camera/graphics_options.rs index 42222057a..8ac7f67eb 100644 --- a/all-is-cubes/src/camera/graphics_options.rs +++ b/all-is-cubes/src/camera/graphics_options.rs @@ -18,9 +18,12 @@ use crate::{block::Block, space::Space}; // (Due to crate splitting that can't be a doc-link.) #[doc = include_str!("../save/serde-warning.md")] #[derive(Clone, Eq, PartialEq)] -#[expect( - clippy::unsafe_derive_deserialize, - reason = "false positive from notnan! macro" +#[cfg_attr( + feature = "save", + expect( + clippy::unsafe_derive_deserialize, + reason = "false positive from notnan! macro" + ) )] #[cfg_attr(feature = "save", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "save", serde(default))] diff --git a/all-is-cubes/src/character/exposure.rs b/all-is-cubes/src/character/exposure.rs index 6974bc6e0..bc7ce16e7 100644 --- a/all-is-cubes/src/character/exposure.rs +++ b/all-is-cubes/src/character/exposure.rs @@ -8,7 +8,7 @@ use euclid::{vec3, Point3D}; use num_traits::float::Float as _; /// Acts as polyfill for float methods -#[cfg(not(feature = "std"))] +#[cfg(not(any(feature = "std", test)))] #[allow(unused_imports)] use crate::math::Euclid as _; diff --git a/all-is-cubes/src/chunking.rs b/all-is-cubes/src/chunking.rs index 0ce9dae1d..42f22b0ca 100644 --- a/all-is-cubes/src/chunking.rs +++ b/all-is-cubes/src/chunking.rs @@ -14,12 +14,12 @@ use std::sync::Mutex; use euclid::{Point3D, Vector3D}; /// Acts as polyfill for float methods -#[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[cfg(not(any(feature = "std", test)))] +#[allow(unused_imports, reason = "unclear why this warns even though it is needed")] use num_traits::float::FloatCore as _; -#[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[cfg(not(any(feature = "std", test)))] +#[allow(unused_imports, reason = "unclear why this warns even though it is needed")] use crate::math::Euclid as _; use crate::math::{ Cube, FreeCoordinate, FreePoint, GridAab, GridCoordinate, GridPoint, OctantMask, diff --git a/all-is-cubes/src/math.rs b/all-is-cubes/src/math.rs index cf635d5a0..07ecc66c9 100644 --- a/all-is-cubes/src/math.rs +++ b/all-is-cubes/src/math.rs @@ -28,7 +28,8 @@ pub use all_is_cubes_base::{notnan, rgb_const, rgba_const}; #[doc = include_str!("save/serde-warning.md")] pub use all_is_cubes_base::math::GridAab; -#[cfg(not(feature = "std"))] +#[cfg(not(any(feature = "std", test)))] +#[allow(dead_code, reason = "unclear why this warns even though it is needed")] /// Identical to [`num_traits::Euclid`] except that its signatures are compatible with /// `std` versions. /// @@ -38,7 +39,7 @@ pub(crate) trait Euclid { fn div_euclid(self, rhs: Self) -> Self; fn rem_euclid(self, rhs: Self) -> Self; } -#[cfg(not(feature = "std"))] +#[cfg(not(any(feature = "std", test)))] impl Euclid for T { fn div_euclid(self, rhs: Self) -> Self { ::div_euclid(&self, &rhs) diff --git a/all-is-cubes/src/physics/body.rs b/all-is-cubes/src/physics/body.rs index 22d19fe5c..dee3ad89f 100644 --- a/all-is-cubes/src/physics/body.rs +++ b/all-is-cubes/src/physics/body.rs @@ -6,8 +6,8 @@ use euclid::Vector3D; use ordered_float::NotNan; /// Acts as polyfill for float methods -#[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[cfg(not(any(feature = "std", test)))] +#[allow(unused_imports, reason = "unclear why this warns even though it is needed")] use num_traits::float::Float as _; use super::collision::{ @@ -16,8 +16,8 @@ use super::collision::{ use crate::block::{BlockCollision, Resolution}; use crate::camera::Eye; use crate::fluff::Fluff; -#[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[cfg(not(any(feature = "std", test)))] +#[allow(unused_imports, reason = "unclear why this warns even though it is needed")] use crate::math::Euclid as _; use crate::math::{Aab, Cube, Face6, Face7, FreeCoordinate, FreePoint, FreeVector, Geometry as _}; use crate::physics::{StopAt, Velocity, POSITION_EPSILON}; diff --git a/all-is-cubes/src/raytracer.rs b/all-is-cubes/src/raytracer.rs index 2343d3346..71271fe7b 100644 --- a/all-is-cubes/src/raytracer.rs +++ b/all-is-cubes/src/raytracer.rs @@ -10,8 +10,11 @@ use core::marker::PhantomData; use euclid::{vec3, Vector3D}; use manyfmt::Fmt; /// Acts as polyfill for float methods -#[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[cfg(not(any(feature = "std", test)))] +#[allow( + unused_imports, + reason = "unclear why this warns even though it is needed" +)] use num_traits::float::Float as _; use ordered_float::NotNan; @@ -21,8 +24,11 @@ use rayon::iter::{IntoParallelIterator as _, ParallelIterator as _}; use crate::block::{Evoxels, Resolution, AIR}; use crate::camera::NdcPoint2; use crate::camera::{Camera, GraphicsOptions, TransparencyOption}; -#[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[cfg(not(any(feature = "std", test)))] +#[allow( + unused_imports, + reason = "unclear why this warns even though it is needed" +)] use crate::math::Euclid as _; use crate::math::{ rgb_const, smoothstep, Cube, Face6, Face7, FreeCoordinate, FreePoint, FreeVector, GridAab, diff --git a/all-is-cubes/src/space/light/data.rs b/all-is-cubes/src/space/light/data.rs index 8332184e2..8a031811c 100644 --- a/all-is-cubes/src/space/light/data.rs +++ b/all-is-cubes/src/space/light/data.rs @@ -5,7 +5,8 @@ use core::fmt; use euclid::default::Vector3D; /// Acts as polyfill for float methods -#[cfg(not(feature = "std"))] +#[cfg(not(any(feature = "std", test)))] +#[allow(unused_imports, reason = "unclear why this warns even though it is needed")] use num_traits::float::Float as _; use crate::math::{NotNan, Rgb}; diff --git a/all-is-cubes/src/universe.rs b/all-is-cubes/src/universe.rs index 9c557a6a4..c42e4099b 100644 --- a/all-is-cubes/src/universe.rs +++ b/all-is-cubes/src/universe.rs @@ -163,7 +163,11 @@ cfg_if::cfg_if! { impl UniverseId { fn new() -> Self { - #![allow(clippy::useless_conversion, reason = "useless on pointer_width=64")] + #![allow( + clippy::useless_conversion, + clippy::unnecessary_fallible_conversions, + reason = "depends on pointer width and atomic support" + )] let id = UNIVERSE_ID_COUNTER .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |counter| {