From c15dc5757b3ebfcde98e0d64a270e9173b26e7d7 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Fri, 13 Sep 2024 13:24:06 -0700 Subject: [PATCH] Rust 1.81: Use `#[expect]` instead of `#[allow]` for expected lint. Also delete no-longer-needed `#[allow]`s. Have not converted `missing_docs` and `clippy::missing_inline_in_public_items` due to false positives. --- all-is-cubes-base/src/lib.rs | 2 +- all-is-cubes-base/src/math.rs | 2 +- all-is-cubes-base/src/math/aab.rs | 1 - all-is-cubes-base/src/math/axis.rs | 2 +- all-is-cubes-base/src/math/color.rs | 4 ++-- all-is-cubes-base/src/math/cube.rs | 2 +- all-is-cubes-base/src/math/face.rs | 17 +++++++++-------- all-is-cubes-base/src/math/matrix.rs | 9 ++++----- all-is-cubes-base/src/math/octant.rs | 2 +- all-is-cubes-base/src/math/rigid.rs | 2 +- all-is-cubes-base/src/math/rotation.rs | 3 +-- all-is-cubes-base/src/math/vol.rs | 6 +++--- all-is-cubes-base/src/raycast/ray.rs | 2 +- all-is-cubes-base/src/time.rs | 2 +- all-is-cubes-base/src/util.rs | 2 +- all-is-cubes-base/src/util/custom_format.rs | 4 ++-- all-is-cubes-content/src/alg.rs | 2 +- all-is-cubes-content/src/animation.rs | 2 +- all-is-cubes-content/src/atrium.rs | 1 - all-is-cubes-content/src/city/exhibit.rs | 1 - .../src/dungeon/demo_dungeon.rs | 2 +- all-is-cubes-content/src/dungeon/generic.rs | 2 +- all-is-cubes-content/src/menu.rs | 2 +- all-is-cubes-content/src/template.rs | 6 +++--- all-is-cubes-content/src/tree.rs | 5 ++--- all-is-cubes-desktop/src/audio.rs | 4 ++-- all-is-cubes-desktop/src/record.rs | 1 - all-is-cubes-desktop/src/record/options.rs | 4 ++-- all-is-cubes-desktop/src/record/rmain.rs | 2 +- all-is-cubes-desktop/src/record/write_gltf.rs | 1 - all-is-cubes-desktop/src/record/write_png.rs | 2 +- all-is-cubes-desktop/src/session.rs | 2 +- all-is-cubes-desktop/src/startup.rs | 6 +++--- all-is-cubes-desktop/src/terminal/ui.rs | 4 ++-- all-is-cubes-desktop/src/winit.rs | 3 +-- all-is-cubes-gpu/benches/wgpu.rs | 2 +- all-is-cubes-gpu/src/common.rs | 2 +- all-is-cubes-gpu/src/common/octree_alloc.rs | 2 +- all-is-cubes-gpu/src/in_wgpu.rs | 9 ++------- all-is-cubes-gpu/src/in_wgpu/bloom.rs | 2 +- all-is-cubes-gpu/src/in_wgpu/glue.rs | 2 +- all-is-cubes-gpu/src/in_wgpu/headless.rs | 2 +- all-is-cubes-gpu/src/in_wgpu/poll.rs | 2 +- .../src/in_wgpu/raytrace_to_texture.rs | 4 ++-- all-is-cubes-gpu/src/in_wgpu/shader_testing.rs | 2 +- all-is-cubes-gpu/src/in_wgpu/space.rs | 5 ++--- all-is-cubes-mesh/src/block_mesh/planar.rs | 2 +- all-is-cubes-mesh/src/block_mesh/viz.rs | 8 ++++---- all-is-cubes-mesh/src/block_vertex.rs | 4 ++-- all-is-cubes-mesh/src/cache.rs | 2 +- .../src/dynamic/chunked_mesh/tests.rs | 4 ++-- all-is-cubes-mesh/src/dynamic/job.rs | 2 +- all-is-cubes-mesh/src/index_vec.rs | 3 +-- all-is-cubes-mesh/src/space_mesh.rs | 8 ++++---- all-is-cubes-mesh/src/tests.rs | 4 ++-- all-is-cubes-mesh/src/texture.rs | 10 +++++----- all-is-cubes-port/src/export.rs | 2 +- all-is-cubes-port/src/gltf.rs | 4 ++-- all-is-cubes-port/src/gltf/texture.rs | 3 +-- all-is-cubes-port/src/import.rs | 4 ++-- all-is-cubes-port/src/mv.rs | 1 - all-is-cubes-port/src/stl.rs | 1 - all-is-cubes-render/benches/raytrace.rs | 2 +- all-is-cubes-render/src/camera/stdcam.rs | 4 ++-- all-is-cubes-render/src/headless.rs | 2 +- all-is-cubes-ui/src/apps/input.rs | 3 +-- all-is-cubes-ui/src/apps/session.rs | 6 +++--- all-is-cubes-ui/src/ui_content/hud.rs | 1 - all-is-cubes-ui/src/ui_content/vui_manager.rs | 3 +-- all-is-cubes-ui/src/vui/layout.rs | 6 +++--- all-is-cubes-ui/src/vui/widgets.rs | 4 ++-- all-is-cubes-ui/src/vui/widgets/button.rs | 2 +- all-is-cubes-ui/src/vui/widgets/text.rs | 2 +- all-is-cubes-ui/src/vui/widgets/theme.rs | 2 +- all-is-cubes-wasm/src/js_bindings.rs | 5 ----- all-is-cubes-wasm/src/lib.rs | 2 +- all-is-cubes-wasm/src/url_params.rs | 2 +- all-is-cubes-wasm/src/web_session.rs | 1 - all-is-cubes/src/behavior.rs | 5 ----- all-is-cubes/src/block.rs | 4 ++-- all-is-cubes/src/block/attributes.rs | 6 +++--- all-is-cubes/src/block/block_def.rs | 2 +- all-is-cubes/src/block/builder.rs | 2 +- all-is-cubes/src/block/eval/control.rs | 1 - all-is-cubes/src/block/eval/tests.rs | 2 +- all-is-cubes/src/block/modifier/composite.rs | 4 ++-- all-is-cubes/src/block/tests.rs | 2 -- all-is-cubes/src/block/text.rs | 2 +- all-is-cubes/src/camera.rs | 12 +++++------- all-is-cubes/src/camera/graphics_options.rs | 2 +- all-is-cubes/src/character.rs | 3 +-- all-is-cubes/src/chunking.rs | 5 ++--- all-is-cubes/src/content/draw_box.rs | 4 ++-- all-is-cubes/src/content/load_image.rs | 2 +- all-is-cubes/src/drawing.rs | 3 --- all-is-cubes/src/inv/inventory.rs | 2 +- all-is-cubes/src/inv/tool.rs | 4 ++-- all-is-cubes/src/linking.rs | 5 ++--- all-is-cubes/src/listen.rs | 1 - all-is-cubes/src/listen/cell.rs | 2 +- all-is-cubes/src/listen/listeners.rs | 2 +- all-is-cubes/src/op.rs | 2 +- all-is-cubes/src/physics.rs | 4 ++-- all-is-cubes/src/physics/collision.rs | 6 +++--- all-is-cubes/src/raytracer/text.rs | 4 ++-- all-is-cubes/src/raytracer/updating.rs | 2 +- all-is-cubes/src/rerun_glue.rs | 4 ++-- all-is-cubes/src/save/schema.rs | 2 +- all-is-cubes/src/save/tests.rs | 6 +++--- all-is-cubes/src/space.rs | 4 ++-- all-is-cubes/src/space/builder.rs | 4 ++-- all-is-cubes/src/space/light/data.rs | 2 +- all-is-cubes/src/space/light/debug.rs | 8 ++++---- all-is-cubes/src/space/light/updater.rs | 4 ++-- all-is-cubes/src/space/palette.rs | 2 +- all-is-cubes/src/transaction.rs | 4 ++-- all-is-cubes/src/transaction/generic.rs | 4 ++-- all-is-cubes/src/transaction/tester.rs | 4 +--- all-is-cubes/src/universe.rs | 7 ++++--- all-is-cubes/src/universe/handle.rs | 3 +-- all-is-cubes/src/universe/members.rs | 9 +++------ all-is-cubes/src/universe/owning_guard.rs | 4 ++-- all-is-cubes/src/universe/universe_txn.rs | 2 +- all-is-cubes/src/util/maybe_sync.rs | 3 --- all-is-cubes/src/util/status_text.rs | 2 +- fuzz/fuzz_targets/fuzz_block_eval.rs | 1 - test-renderers/src/harness.rs | 3 +-- test-renderers/src/image_files.rs | 6 +++--- test-renderers/src/lib.rs | 9 ++++----- test-renderers/src/render.rs | 4 ++-- test-renderers/src/report.rs | 2 +- test-renderers/src/test_cases.rs | 5 ++--- 132 files changed, 202 insertions(+), 258 deletions(-) diff --git a/all-is-cubes-base/src/lib.rs b/all-is-cubes-base/src/lib.rs index 29e817adf..957c900db 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"), allow(clippy::arc_with_non_send_sync))] +#![cfg_attr(not(feature = "std"), expect(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 2ed7ddfba..511c26495 100644 --- a/all-is-cubes-base/src/math.rs +++ b/all-is-cubes-base/src/math.rs @@ -175,7 +175,7 @@ pub trait Geometry { /// /// The primary way in which these are used is [`Geometry::wireframe_points()`]. #[derive(Clone, Copy, Debug, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct LineVertex { /// Position of the vertex. pub position: FreePoint, diff --git a/all-is-cubes-base/src/math/aab.rs b/all-is-cubes-base/src/math/aab.rs index abb241175..70f60c019 100644 --- a/all-is-cubes-base/src/math/aab.rs +++ b/all-is-cubes-base/src/math/aab.rs @@ -355,7 +355,6 @@ impl Geometry for Aab { where E: Extend, { - #[allow(clippy::large_stack_arrays)] let mut vertices = [LineVertex::from(FreePoint::origin()); 24]; let l = self.lower_bounds_p(); let u = self.upper_bounds_p(); diff --git a/all-is-cubes-base/src/math/axis.rs b/all-is-cubes-base/src/math/axis.rs index 052e2ff02..9d9d82a03 100644 --- a/all-is-cubes-base/src/math/axis.rs +++ b/all-is-cubes-base/src/math/axis.rs @@ -9,7 +9,7 @@ use crate::math::{Face6, Rgb}; /// See also: /// /// * [`Face6`] specifies an axis and a direction on the axis. -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, exhaust::Exhaust)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] // do after tests:#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] diff --git a/all-is-cubes-base/src/math/color.rs b/all-is-cubes-base/src/math/color.rs index f4affd1ff..d5640883d 100644 --- a/all-is-cubes-base/src/math/color.rs +++ b/all-is-cubes-base/src/math/color.rs @@ -76,7 +76,7 @@ pub struct Rgba { /// Unit-of-measure type for vectors that contain color channels. //--- // TODO(euclid migration): Better name? -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug, Eq, PartialEq)] pub enum Intensity {} @@ -669,7 +669,7 @@ const fn component_from_srgb8_const(c: u8) -> NotNan { /// frame. #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[repr(u8)] pub enum OpacityCategory { /// Alpha of zero; completely transparent; completely invisible; need not be drawn. diff --git a/all-is-cubes-base/src/math/cube.rs b/all-is-cubes-base/src/math/cube.rs index 06f230cee..87d0de75a 100644 --- a/all-is-cubes-base/src/math/cube.rs +++ b/all-is-cubes-base/src/math/cube.rs @@ -162,7 +162,7 @@ impl Cube { /// Apply a function to each coordinate independently. /// /// If a different return type is desired, use `.lower_bounds().map(f)` instead. - #[allow(clippy::return_self_not_must_use)] + #[expect(clippy::return_self_not_must_use)] #[inline] pub fn map(self, mut f: impl FnMut(GridCoordinate) -> GridCoordinate) -> Self { Self { diff --git a/all-is-cubes-base/src/math/face.rs b/all-is-cubes-base/src/math/face.rs index 5485f3e59..a210e5cac 100644 --- a/all-is-cubes-base/src/math/face.rs +++ b/all-is-cubes-base/src/math/face.rs @@ -24,8 +24,7 @@ use crate::math::{ /// variant. The two enums use the same discriminant numbering. /// #[doc = include_str!("../serde-warning.md")] -#[allow(clippy::upper_case_acronyms)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, exhaust::Exhaust)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -52,8 +51,7 @@ pub enum Face6 { /// provided. The two enums use the same discriminant numbering. /// #[doc = include_str!("../serde-warning.md")] -#[allow(clippy::upper_case_acronyms)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, exhaust::Exhaust)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -108,7 +106,10 @@ impl Face6 { /// * If all magnitudes are zero, the Z axis's sign is used. (Remember that floating-point /// numbers include distinct positive and negative zeroes). /// * If any coordinate is NaN, returns [`None`]. - #[allow(unused)] // TODO: I expect to use this in block placement + #[cfg_attr( + not(test), + expect(dead_code, reason = "TODO: I expect to use this in block placement") + )] fn from_snapped_vector(vector: FreeVector) -> Option { let Vector3D { x, y, z, _unit } = vector; @@ -589,7 +590,7 @@ impl TryFrom for Face7 { /// is needed, such as converting to a [`Face6`]. #[derive(Copy, Clone, Debug, Eq, PartialEq, displaydoc::Display)] #[displaydoc("Face7::Within does not have a direction or axis")] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct Faceless; #[cfg(feature = "rerun")] @@ -627,7 +628,7 @@ impl From for re_types::view_coordinates::SignedAxis3 { } /// Container for values keyed by [`Face6`]s. Always holds exactly six elements. -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, Default, Hash, PartialEq, Eq, exhaust::Exhaust)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] pub struct FaceMap { @@ -919,7 +920,7 @@ impl_binary_operator_for_facemap!(Rem::rem); /// The combination of a [`Cube`] and [`Face7`] identifying one face of it or the interior. /// This pattern appears in cursor selection and collision detection. #[derive(Clone, Copy, Hash, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[allow(missing_docs)] pub struct CubeFace { pub cube: Cube, diff --git a/all-is-cubes-base/src/math/matrix.rs b/all-is-cubes-base/src/math/matrix.rs index 64702302a..b49abef1d 100644 --- a/all-is-cubes-base/src/math/matrix.rs +++ b/all-is-cubes-base/src/math/matrix.rs @@ -22,7 +22,7 @@ use crate::math::{ /// TODO: The operators implemented for this are very incomplete. /// /// TODO(euclid migration): Can we dispose of this type now? -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct GridMatrix { /// First column @@ -55,7 +55,7 @@ impl GridMatrix { /// Note: This takes the elements in a column-major ordering, so the argument order /// is transposed relative to a conventional textual display of a matrix. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] #[inline] pub const fn new( x0: GridCoordinate, @@ -297,7 +297,7 @@ impl GridMatrix { const INVERSE_EPSILON: FreeCoordinate = 0.25 / (GridCoordinate::MAX as FreeCoordinate); fn try_round(v: [FreeCoordinate; 4], expected_w: FreeCoordinate) -> Option { let mut result = Vector3D::zero(); - #[allow(clippy::needless_range_loop)] + #[expect(clippy::needless_range_loop)] for axis in 0..4 { let rounded = v[axis].round(); let remainder = v[axis] - rounded; @@ -312,7 +312,7 @@ impl GridMatrix { 2 => result.z = rounded as GridCoordinate, 3 => { - #[allow(clippy::float_cmp)] + #[expect(clippy::float_cmp)] if rounded != expected_w { return None; } @@ -334,7 +334,6 @@ impl GridMatrix { } /// Mini 4D vector for matrix rows. -#[allow(clippy::exhaustive_structs)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] struct MVector4 { x: T, diff --git a/all-is-cubes-base/src/math/octant.rs b/all-is-cubes-base/src/math/octant.rs index 860c2f063..a59ea961d 100644 --- a/all-is-cubes-base/src/math/octant.rs +++ b/all-is-cubes-base/src/math/octant.rs @@ -11,7 +11,7 @@ use crate::math::{Cube, Face6, FreeVector, GridCoordinate, GridPoint}; /// This enum's discriminants are not currently to be considered stable; they may be reordered. //--- // TODO: Replace this with an enum. -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Clone, Copy, Eq, Hash, PartialEq, exhaust::Exhaust)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[repr(u8)] diff --git a/all-is-cubes-base/src/math/rigid.rs b/all-is-cubes-base/src/math/rigid.rs index a218ce644..11cae5581 100644 --- a/all-is-cubes-base/src/math/rigid.rs +++ b/all-is-cubes-base/src/math/rigid.rs @@ -12,7 +12,7 @@ use crate::math::{GridAab, GridCoordinate}; /// These transformations are always invertible except in the case of numeric overflow. /// /// [rigid transformation]: https://en.wikipedia.org/wiki/Rigid_transformation -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct Gridgid { /// Rotation component. Applied before the translation. diff --git a/all-is-cubes-base/src/math/rotation.rs b/all-is-cubes-base/src/math/rotation.rs index 2fe4fa28e..c0d730e85 100644 --- a/all-is-cubes-base/src/math/rotation.rs +++ b/all-is-cubes-base/src/math/rotation.rs @@ -31,8 +31,7 @@ use crate::math::GridAab; /// #[doc = include_str!("../serde-warning.md")] #[rustfmt::skip] -#[allow(clippy::upper_case_acronyms)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[allow(missing_docs)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] diff --git a/all-is-cubes-base/src/math/vol.rs b/all-is-cubes-base/src/math/vol.rs index ab0eea1c1..03b97ed73 100644 --- a/all-is-cubes-base/src/math/vol.rs +++ b/all-is-cubes-base/src/math/vol.rs @@ -20,7 +20,7 @@ use crate::math::{Axis, Cube, GridAab, GridCoordinate, GridIter, GridPoint, Grid /// /// Use this type with [`Vol`] to store volume data in this order. #[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct ZMaj; /// Type for volume data stored in a slice, or for generating linear indexing. @@ -191,7 +191,7 @@ where // TODO: Reimplement this in terms of adopting the elements as a linear array. // TODO: Test. #[doc(hidden)] // used by all-is-cubes-content - #[allow(clippy::needless_pass_by_value)] + #[expect(clippy::needless_pass_by_value)] pub fn from_y_flipped_array( array: [[[V; DX]; DY]; DZ], ) -> Self @@ -782,7 +782,7 @@ fn find_zmaj_subdivision(bounds: GridAab) -> Option<(GridAab, GridAab, usize)> { let axis_range = bounds.axis_range(axis); let size: u32 = bounds.size()[axis]; if size >= 2 { - #[allow(clippy::cast_possible_wrap, reason = "known to fit")] + #[expect(clippy::cast_possible_wrap, reason = "known to fit")] let split_coordinate = axis_range.start + (size / 2) as i32; let mut lower_half_ub = bounds.upper_bounds(); diff --git a/all-is-cubes-base/src/raycast/ray.rs b/all-is-cubes-base/src/raycast/ray.rs index be840364d..0c33a9eb0 100644 --- a/all-is-cubes-base/src/raycast/ray.rs +++ b/all-is-cubes-base/src/raycast/ray.rs @@ -19,7 +19,7 @@ use crate::math::GridAab; /// A ray; a half-infinite line segment (sometimes used as finite by the length of the /// direction vector). -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, Debug, PartialEq)] pub struct Ray { // TODO(euclid migration): should we expose the coordinate unit generic? diff --git a/all-is-cubes-base/src/time.rs b/all-is-cubes-base/src/time.rs index 0306c30d6..d11e81897 100644 --- a/all-is-cubes-base/src/time.rs +++ b/all-is-cubes-base/src/time.rs @@ -40,7 +40,7 @@ impl Instant for std::time::Instant { /// is available **and it's okay for all time measurements to be recorded as zero**. #[doc(hidden)] #[derive(Debug, Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct NoTime; impl Instant for NoTime { diff --git a/all-is-cubes-base/src/util.rs b/all-is-cubes-base/src/util.rs index 734be3498..99dd38d37 100644 --- a/all-is-cubes-base/src/util.rs +++ b/all-is-cubes-base/src/util.rs @@ -92,7 +92,7 @@ mod error_chain { /// which interferes with this one for [`Error`]. #[doc(hidden)] // not something we wish to be stable public API #[derive(Clone, Copy, Debug)] - #[allow(clippy::exhaustive_structs)] + #[expect(clippy::exhaustive_structs)] pub struct ErrorChain<'a>(pub &'a (dyn Error + 'a)); impl fmt::Display for ErrorChain<'_> { diff --git a/all-is-cubes-base/src/util/custom_format.rs b/all-is-cubes-base/src/util/custom_format.rs index dac5df8d7..4baacc5a8 100644 --- a/all-is-cubes-base/src/util/custom_format.rs +++ b/all-is-cubes-base/src/util/custom_format.rs @@ -10,7 +10,7 @@ use manyfmt::{Fmt, Refmt as _}; /// The value is a `PhantomData` to avoid requiring an actual instance of the type. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[doc(hidden)] // too specific to be good public API ... arguably should be part of refmt itself. -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct TypeName; impl Fmt for PhantomData { fn fmt(&self, fmt: &mut fmt::Formatter<'_>, _: &TypeName) -> fmt::Result { @@ -23,7 +23,7 @@ impl Fmt for PhantomData { /// /// This format may be on one line despite the pretty-printing option, and may lose /// precision or Rust syntax in favor of a short at-a-glance representation. -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct ConciseDebug; diff --git a/all-is-cubes-content/src/alg.rs b/all-is-cubes-content/src/alg.rs index ca2ec84e0..c53980a3c 100644 --- a/all-is-cubes-content/src/alg.rs +++ b/all-is-cubes-content/src/alg.rs @@ -154,7 +154,7 @@ pub(crate) fn space_to_space_copy( } /// As [`space_to_space_copy`], but producing a transaction. -#[allow(dead_code)] // TODO: currently unused but will probably come up again...? +#[expect(dead_code)] // TODO: currently unused but will probably come up again...? pub(crate) fn space_to_transaction_copy( src: &Space, src_bounds: GridAab, diff --git a/all-is-cubes-content/src/animation.rs b/all-is-cubes-content/src/animation.rs index e88b29545..b60279592 100644 --- a/all-is-cubes-content/src/animation.rs +++ b/all-is-cubes-content/src/animation.rs @@ -102,7 +102,7 @@ pub(crate) struct Fire { blocks: [Block; 4], /// The bounds of this array determine the affected blocks. // TODO: should be using the attachment bounds instead of internally stored bounds - #[allow(clippy::struct_field_names)] + #[expect(clippy::struct_field_names)] fire_state: Vol>, rng: Xoshiro256Plus, /// Time accumulation not yet equal to a whole frame. diff --git a/all-is-cubes-content/src/atrium.rs b/all-is-cubes-content/src/atrium.rs index 9ee5fe91a..2c482f90f 100644 --- a/all-is-cubes-content/src/atrium.rs +++ b/all-is-cubes-content/src/atrium.rs @@ -327,7 +327,6 @@ fn map_text_block( } } -#[allow(clippy::too_many_arguments)] fn arch_row( space: &mut Space, blocks: &BlockProvider, diff --git a/all-is-cubes-content/src/city/exhibit.rs b/all-is-cubes-content/src/city/exhibit.rs index 09f256493..77d36cdd2 100644 --- a/all-is-cubes-content/src/city/exhibit.rs +++ b/all-is-cubes-content/src/city/exhibit.rs @@ -8,7 +8,6 @@ use all_is_cubes_ui::vui::widgets; use crate::city::CityPlanner; -#[allow(clippy::type_complexity)] pub(crate) struct Exhibit { pub name: &'static str, pub subtitle: &'static str, diff --git a/all-is-cubes-content/src/dungeon/demo_dungeon.rs b/all-is-cubes-content/src/dungeon/demo_dungeon.rs index e7840aea7..c4ffffd7f 100644 --- a/all-is-cubes-content/src/dungeon/demo_dungeon.rs +++ b/all-is-cubes-content/src/dungeon/demo_dungeon.rs @@ -1,4 +1,4 @@ -#![allow(unused_qualifications)] // macro false positive +#![expect(unused_qualifications)] // macro false positive use core::f64::consts::TAU; use core::mem; diff --git a/all-is-cubes-content/src/dungeon/generic.rs b/all-is-cubes-content/src/dungeon/generic.rs index e005de3bd..e02b368be 100644 --- a/all-is-cubes-content/src/dungeon/generic.rs +++ b/all-is-cubes-content/src/dungeon/generic.rs @@ -58,7 +58,7 @@ impl DungeonGrid { } /// Returns the volume which lies between two rooms and meets their adjoining faces. - #[allow(dead_code)] // TODO: superseded in use by theme-specific sizes; review if should keep + #[expect(dead_code)] // TODO: superseded in use by theme-specific sizes; review if should keep pub fn shared_wall_at(&self, room_position: Cube, face: Face6) -> GridAab { self.room_box_at(room_position) .abut( diff --git a/all-is-cubes-content/src/menu.rs b/all-is-cubes-content/src/menu.rs index 3bf8eea9a..f27a80f1b 100644 --- a/all-is-cubes-content/src/menu.rs +++ b/all-is-cubes-content/src/menu.rs @@ -65,7 +65,7 @@ pub async fn template_menu_space( Ok(space) } -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] fn template_menu_widget_tree( widget_theme: &widgets::WidgetTheme, action: Arc, diff --git a/all-is-cubes-content/src/template.rs b/all-is-cubes-content/src/template.rs index 92b9c5c10..2aad370be 100644 --- a/all-is-cubes-content/src/template.rs +++ b/all-is-cubes-content/src/template.rs @@ -246,7 +246,7 @@ fn insert_generated_space( /// /// Pass this structure to [`UniverseTemplate::build()`]. #[derive(Clone, Debug, Default, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct TemplateParameters { /// Seed for any randomization which the template performs. /// Not all templates have random elements. @@ -324,7 +324,7 @@ async fn islands( let size = size.unwrap_or(GridSize::new(1000, 400, 1000)); // Set up dimensions - #[allow(clippy::cast_possible_wrap, reason = "big numbers will break anyway")] + #[expect(clippy::cast_possible_wrap, reason = "big numbers will break anyway")] let bounds = GridAab::checked_from_lower_size( [ -((size.width / 2) as i32), @@ -494,7 +494,7 @@ mod tests { use all_is_cubes::util::yield_progress_for_testing; use futures_core::future::BoxFuture; - #[allow(clippy::let_underscore_future)] + #[expect(clippy::let_underscore_future)] fn _test_build_future_is_send() { let _: BoxFuture<'_, _> = Box::pin(UniverseTemplate::Atrium.build::( yield_progress_for_testing(), diff --git a/all-is-cubes-content/src/tree.rs b/all-is-cubes-content/src/tree.rs index f4e95bca8..779f96efe 100644 --- a/all-is-cubes-content/src/tree.rs +++ b/all-is-cubes-content/src/tree.rs @@ -16,8 +16,7 @@ use crate::LandscapeBlocks::{self, Leaves, Log}; /// /// TODO: make the public version of this a struct with private contents #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, exhaust::Exhaust)] -#[allow(clippy::exhaustive_enums)] -#[allow( +#[expect( unnameable_types, reason = "TODO: this should be public with an opaque struct wrapper" )] @@ -214,7 +213,7 @@ pub(crate) fn make_tree( use graph::Growph; mod graph { - #![allow(clippy::option_option)] + #![expect(clippy::option_option)] use super::*; use all_is_cubes::euclid::default::Vector3D; diff --git a/all-is-cubes-desktop/src/audio.rs b/all-is-cubes-desktop/src/audio.rs index bf367eb50..c41f9cc64 100644 --- a/all-is-cubes-desktop/src/audio.rs +++ b/all-is-cubes-desktop/src/audio.rs @@ -13,7 +13,7 @@ use crate::Session; /// Fills the audio slot in a `DesktopSession` to actually produce audio. pub(crate) struct AudioOut { - #[allow( + #[expect( dead_code, reason = "eventually we're going to need this for volume control etc." )] @@ -53,7 +53,7 @@ pub(crate) fn init_sound(session: &Session) -> Result { } /// Thread function for receiving commands and executing them on `&mut AudioManager`. -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] fn audio_command_thread(receiver: mpsc::Receiver, mut manager: AudioManager) { // TODO: better sound and more sounds let beep = StaticSoundData { diff --git a/all-is-cubes-desktop/src/record.rs b/all-is-cubes-desktop/src/record.rs index 4a88d2f6e..bba651539 100644 --- a/all-is-cubes-desktop/src/record.rs +++ b/all-is-cubes-desktop/src/record.rs @@ -40,7 +40,6 @@ pub(crate) struct Recorder { } // TODO: should this be a trait? It's also an awful lot like HeadlessRenderer, except without the image output... -#[allow(clippy::large_enum_variant)] #[derive(Debug)] enum RecorderInner { Shutdown, diff --git a/all-is-cubes-desktop/src/record/options.rs b/all-is-cubes-desktop/src/record/options.rs index 9441148f3..e993b6648 100644 --- a/all-is-cubes-desktop/src/record/options.rs +++ b/all-is-cubes-desktop/src/record/options.rs @@ -10,7 +10,7 @@ use all_is_cubes_render::camera::{self, Viewport}; /// /// Part of [`InnerMainParams`](crate::InnerMainParams). #[derive(Clone, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] // TODO: make fields private again +#[expect(clippy::exhaustive_structs)] // TODO: make fields private again #[allow(missing_docs)] pub struct RecordOptions { pub output_path: PathBuf, @@ -21,7 +21,7 @@ pub struct RecordOptions { } #[derive(Clone, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] // TODO: make fields private again +#[expect(clippy::exhaustive_structs)] // TODO: make fields private again #[allow(missing_docs)] pub struct RecordAnimationOptions { pub frame_count: usize, diff --git a/all-is-cubes-desktop/src/record/rmain.rs b/all-is-cubes-desktop/src/record/rmain.rs index 68db05adf..7b03cc39c 100644 --- a/all-is-cubes-desktop/src/record/rmain.rs +++ b/all-is-cubes-desktop/src/record/rmain.rs @@ -13,7 +13,7 @@ use crate::session::{ClockSource, DesktopSession}; /// Use [`RecordOptions`] to configure `dsession`'s clock and graphics options. /// /// TODO: Change things around so that this can be done by the main task as needed. -#[allow(clippy::unnecessary_wraps)] +#[expect(clippy::unnecessary_wraps)] pub(crate) fn configure_session_for_recording( dsession: &mut DesktopSession, options: &RecordOptions, diff --git a/all-is-cubes-desktop/src/record/write_gltf.rs b/all-is-cubes-desktop/src/record/write_gltf.rs index 665a14b86..eec063b0c 100644 --- a/all-is-cubes-desktop/src/record/write_gltf.rs +++ b/all-is-cubes-desktop/src/record/write_gltf.rs @@ -120,7 +120,6 @@ impl MeshRecorder { /// Data stream sent from the mesh creation stage to the glTF serialization stage. #[derive(Debug)] -#[allow(clippy::large_enum_variant)] pub(crate) enum MeshRecordMsg { AddMesh(MeshId, mesh::SpaceMesh, MeshIndexCell), FinishFrame( diff --git a/all-is-cubes-desktop/src/record/write_png.rs b/all-is-cubes-desktop/src/record/write_png.rs index 47daea5e7..c170598b9 100644 --- a/all-is-cubes-desktop/src/record/write_png.rs +++ b/all-is-cubes-desktop/src/record/write_png.rs @@ -10,7 +10,7 @@ use all_is_cubes_render::Rendering; use crate::record::{RecordOptions, Status}; /// Occupy a thread with writing a sequence of frames as (A)PNG data. -#[allow( +#[expect( clippy::needless_pass_by_value, reason = "let thread function own its state" )] diff --git a/all-is-cubes-desktop/src/session.rs b/all-is-cubes-desktop/src/session.rs index 11f64e89e..6d30a0761 100644 --- a/all-is-cubes-desktop/src/session.rs +++ b/all-is-cubes-desktop/src/session.rs @@ -197,7 +197,7 @@ impl DesktopSession { ); } - #[cfg_attr(not(feature = "terminal"), allow(dead_code))] + #[cfg_attr(not(feature = "terminal"), expect(dead_code))] pub(crate) fn into_renderer_and_window(self) -> (DesktopSession<(), ()>, Ren, Win) { ( DesktopSession { diff --git a/all-is-cubes-desktop/src/startup.rs b/all-is-cubes-desktop/src/startup.rs index 0bf0af451..eb2a4ffa4 100644 --- a/all-is-cubes-desktop/src/startup.rs +++ b/all-is-cubes-desktop/src/startup.rs @@ -47,7 +47,7 @@ pub fn inner_main( task_done_signal, } = params; - #[cfg_attr(not(feature = "record"), allow(unused_variables))] + #[cfg_attr(not(feature = "record"), expect(unused_variables))] let executor = Executor::new(runtime.handle().clone()); // At this point we have just finished whatever the GraphicsType did before calling @@ -211,7 +211,7 @@ pub fn headless_main_loop( /// Ad-hoc struct of arguments to [`inner_main`] that can be constructed before choosing an /// event loop type. #[derive(Debug)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[allow(missing_docs)] // TODO: give this an API-design pass too pub struct InnerMainParams { pub application_title: String, @@ -278,7 +278,7 @@ impl UniverseTask { } } -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] fn report_error_and_exit(_ctx: &MainTaskContext, error: anyhow::Error) -> ! { // TODO: if we are a GUI-no-terminal session, log this instead of printing and create a dialog // instead of exiting. diff --git a/all-is-cubes-desktop/src/terminal/ui.rs b/all-is-cubes-desktop/src/terminal/ui.rs index 16e972fe2..b7aee20b2 100644 --- a/all-is-cubes-desktop/src/terminal/ui.rs +++ b/all-is-cubes-desktop/src/terminal/ui.rs @@ -152,7 +152,7 @@ impl TerminalWindow { } /// Send the cleanup command and wait for the thread to exit. - #[allow(clippy::unnecessary_wraps)] // see TODO below + #[expect(clippy::unnecessary_wraps)] // see TODO below pub(crate) fn stop(mut self) -> Result<(), anyhow::Error> { // Drop channel to signal thread to shut down self.out_sender = None; @@ -171,7 +171,7 @@ impl TerminalWindow { } fn update(&mut self) { - #[allow(clippy::while_let_loop, reason = "this is clearer about its behavior")] + #[expect(clippy::while_let_loop, reason = "this is clearer about its behavior")] loop { match self.in_receiver.try_recv() { Ok(InMsg::Viewport(v)) => self.viewport_position = v, diff --git a/all-is-cubes-desktop/src/winit.rs b/all-is-cubes-desktop/src/winit.rs index 21c1e3d4f..713dae981 100644 --- a/all-is-cubes-desktop/src/winit.rs +++ b/all-is-cubes-desktop/src/winit.rs @@ -163,7 +163,7 @@ pub fn winit_main_loop_and_init( } /// Creates a [`DesktopSession`] that can be run in an [`winit`] event loop. -#[allow(clippy::large_stack_frames)] +#[expect(clippy::large_stack_frames)] pub async fn create_winit_wgpu_desktop_session( executor: Arc, session: Session, @@ -484,7 +484,6 @@ fn handle_window_event( /// TODO: Give this a better name and definition. /// Or remove it entirely since we no longer have multiple renderers targeting winit windows. #[doc(hidden)] -#[allow(unnameable_types)] pub trait RendererToWinit: crate::glue::Renderer + 'static { #[doc(hidden)] fn update_world_camera(&mut self); diff --git a/all-is-cubes-gpu/benches/wgpu.rs b/all-is-cubes-gpu/benches/wgpu.rs index 1f16e9f1a..c56e7bc95 100644 --- a/all-is-cubes-gpu/benches/wgpu.rs +++ b/all-is-cubes-gpu/benches/wgpu.rs @@ -33,7 +33,7 @@ fn main() { criterion.final_summary(); } -#[allow(clippy::await_holding_lock)] +#[expect(clippy::await_holding_lock)] fn render_benches(runtime: &Runtime, c: &mut Criterion, instance: &wgpu::Instance) { let mut g = c.benchmark_group("render"); diff --git a/all-is-cubes-gpu/src/common.rs b/all-is-cubes-gpu/src/common.rs index db21fe3f5..867e51704 100644 --- a/all-is-cubes-gpu/src/common.rs +++ b/all-is-cubes-gpu/src/common.rs @@ -131,7 +131,7 @@ impl Memo { } /// Drop the stored value, if any. - #[cfg_attr(not(feature = "rerun"), allow(unused))] // currently not otherwise used + #[cfg_attr(not(feature = "rerun"), expect(unused))] // currently not otherwise used pub fn clear(&mut self) { self.data = None; } diff --git a/all-is-cubes-gpu/src/common/octree_alloc.rs b/all-is-cubes-gpu/src/common/octree_alloc.rs index 866ef11d0..dc7d43014 100644 --- a/all-is-cubes-gpu/src/common/octree_alloc.rs +++ b/all-is-cubes-gpu/src/common/octree_alloc.rs @@ -132,7 +132,7 @@ impl Alloctree { /// /// If the handle does not exactly match a previous allocation from this allocator, /// may panic or deallocate something else. - #[allow( + #[expect( clippy::needless_pass_by_value, reason = "deliberately taking handle ownership" )] diff --git a/all-is-cubes-gpu/src/in_wgpu.rs b/all-is-cubes-gpu/src/in_wgpu.rs index e47418c53..774f8110e 100644 --- a/all-is-cubes-gpu/src/in_wgpu.rs +++ b/all-is-cubes-gpu/src/in_wgpu.rs @@ -135,7 +135,7 @@ impl SurfaceRenderer { None, ) .await?; - #[cfg_attr(target_family = "wasm", allow(clippy::arc_with_non_send_sync))] + #[cfg_attr(target_family = "wasm", expect(clippy::arc_with_non_send_sync))] let device = Arc::new(device); let viewport_source = cameras.viewport_source(); @@ -299,7 +299,6 @@ struct EverythingRenderer { /// Pipeline for the color postprocessing + info text layer drawing. postprocess_render_pipeline: Memo, wgpu::RenderPipeline>, - #[allow(clippy::type_complexity)] postprocess_bind_group: Memo<(Id, frame_texture::FbtId), wgpu::BindGroup>, postprocess_bind_group_layout: wgpu::BindGroupLayout, postprocess_camera_buffer: wgpu::Buffer, @@ -882,10 +881,6 @@ impl EverythingRenderer { info_text_texture.upload(queue); } - #[allow( - clippy::let_and_return, - reason = "" - )] let flaws = postprocess::postprocess(self, queue, output); #[cfg(feature = "rerun")] @@ -948,7 +943,7 @@ fn choose_surface_format(capabilities: &wgpu::SurfaceCapabilities) -> wgpu::Text // TODO: repro and report to wgpu, supposing that it is a wgpu bug is_float: matches!(format, Rgba16Float | Rgba32Float | Rgb9e5Ufloat) && !cfg!(target_family = "wasm"), - #[allow(clippy::cast_possible_wrap)] + #[expect(clippy::cast_possible_wrap)] negated_original_order: -(index as isize), } }) diff --git a/all-is-cubes-gpu/src/in_wgpu/bloom.rs b/all-is-cubes-gpu/src/in_wgpu/bloom.rs index 100b50821..898ee35af 100644 --- a/all-is-cubes-gpu/src/in_wgpu/bloom.rs +++ b/all-is-cubes-gpu/src/in_wgpu/bloom.rs @@ -110,7 +110,7 @@ impl BloomPipelines { cache: None, }); - #[cfg_attr(target_family = "wasm", allow(clippy::arc_with_non_send_sync))] + #[cfg_attr(target_family = "wasm", expect(clippy::arc_with_non_send_sync))] Arc::new(Self { bind_group_layout, diff --git a/all-is-cubes-gpu/src/in_wgpu/glue.rs b/all-is-cubes-gpu/src/in_wgpu/glue.rs index ee22f8186..25a600bb9 100644 --- a/all-is-cubes-gpu/src/in_wgpu/glue.rs +++ b/all-is-cubes-gpu/src/in_wgpu/glue.rs @@ -21,7 +21,7 @@ pub fn to_wgpu_color(color: Rgba) -> wgpu::Color { } } -#[allow( +#[expect( clippy::needless_pass_by_value, reason = "the value is nearly a reference itself" )] diff --git a/all-is-cubes-gpu/src/in_wgpu/headless.rs b/all-is-cubes-gpu/src/in_wgpu/headless.rs index 45dc3ff87..bbe6f0285 100644 --- a/all-is-cubes-gpu/src/in_wgpu/headless.rs +++ b/all-is-cubes-gpu/src/in_wgpu/headless.rs @@ -28,7 +28,7 @@ pub struct Builder { impl Builder { /// Create a [`Builder`] by obtaining a new [`wgpu::Device`] from the given adapter. - #[cfg_attr(target_family = "wasm", allow(clippy::arc_with_non_send_sync))] + #[cfg_attr(target_family = "wasm", expect(clippy::arc_with_non_send_sync))] pub async fn from_adapter( label: &str, adapter: wgpu::Adapter, diff --git a/all-is-cubes-gpu/src/in_wgpu/poll.rs b/all-is-cubes-gpu/src/in_wgpu/poll.rs index 8b034c107..7996fb1b6 100644 --- a/all-is-cubes-gpu/src/in_wgpu/poll.rs +++ b/all-is-cubes-gpu/src/in_wgpu/poll.rs @@ -73,7 +73,7 @@ mod inner { /// Polls all [`wgpu::Device`]s delivered to it on `POLLING_CHANNEL`. /// To be run on a thread or async task as the platform permits. -#[allow(clippy::infinite_loop)] +#[expect(clippy::infinite_loop)] async fn polling_task(rx: flume::Receiver>) { // 10 milliseconds is much better than acceptable latency for our applications, which are all // non-realtime headless rendering. diff --git a/all-is-cubes-gpu/src/in_wgpu/raytrace_to_texture.rs b/all-is-cubes-gpu/src/in_wgpu/raytrace_to_texture.rs index 986284138..fad8a54c7 100644 --- a/all-is-cubes-gpu/src/in_wgpu/raytrace_to_texture.rs +++ b/all-is-cubes-gpu/src/in_wgpu/raytrace_to_texture.rs @@ -212,7 +212,7 @@ impl Inner { #[cfg(feature = "auto-threads")] /// Runs raytracing, periodically releasing the lock to allow updating input and retrieving output. -#[allow( +#[expect( clippy::needless_pass_by_value, reason = "let thread function own its state" )] @@ -263,7 +263,7 @@ impl PixelPicker { impl Iterator for PixelPicker { type Item = Point; - #[allow(clippy::cast_possible_wrap)] + #[expect(clippy::cast_possible_wrap)] fn next(&mut self) -> Option { // `as usize` is safe because we would have failed earlier if it doesn't fit in usize. let size = self.viewport.framebuffer_size.map(|s| s as usize); diff --git a/all-is-cubes-gpu/src/in_wgpu/shader_testing.rs b/all-is-cubes-gpu/src/in_wgpu/shader_testing.rs index 9b212b6d9..25e112a3b 100644 --- a/all-is-cubes-gpu/src/in_wgpu/shader_testing.rs +++ b/all-is-cubes-gpu/src/in_wgpu/shader_testing.rs @@ -50,7 +50,7 @@ where ) .await .unwrap(); - #[cfg_attr(target_family = "wasm", allow(clippy::arc_with_non_send_sync))] + #[cfg_attr(target_family = "wasm", expect(clippy::arc_with_non_send_sync))] let device = Arc::new(device); let shaders = Shaders::new(&device); diff --git a/all-is-cubes-gpu/src/in_wgpu/space.rs b/all-is-cubes-gpu/src/in_wgpu/space.rs index e73b52279..9a2d1e249 100644 --- a/all-is-cubes-gpu/src/in_wgpu/space.rs +++ b/all-is-cubes-gpu/src/in_wgpu/space.rs @@ -77,7 +77,6 @@ pub(crate) struct SpaceRenderer { instance_buffer: ResizingBuffer, /// Bind group containing our block texture and light texture, - #[allow(clippy::type_complexity)] space_bind_group: Memo<[crate::Id; 4], wgpu::BindGroup>, /// Mesh generator and updater. @@ -436,7 +435,7 @@ impl SpaceRenderer { /// /// Does not access the [`Space`] contents at all. // TODO: needs error return or not? - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub fn draw( &self, fb: &FramebufferTextures, @@ -907,7 +906,7 @@ fn set_buffers<'a>(render_pass: &mut wgpu::RenderPass<'a>, buffers: &'a ChunkBuf } /// Copy [`SpaceMesh`] data to GPU buffers. -#[allow( +#[expect( clippy::needless_pass_by_value, reason = "https://github.com/rust-lang/rust-clippy/issues/12525" )] diff --git a/all-is-cubes-mesh/src/block_mesh/planar.rs b/all-is-cubes-mesh/src/block_mesh/planar.rs index ce0aad34c..a83d2cf5c 100644 --- a/all-is-cubes-mesh/src/block_mesh/planar.rs +++ b/all-is-cubes-mesh/src/block_mesh/planar.rs @@ -204,7 +204,7 @@ impl Clone for QuadColoring<'_, T> { /// /// `depth`, `low_corner`, and `high_corner` are in units of 1 texel. #[inline] -#[allow(clippy::too_many_arguments)] // TODO: Figure out how to simplify +#[expect(clippy::too_many_arguments)] // TODO: Figure out how to simplify pub(super) fn push_quad>, Tex: texture::Plane>( vertices: &mut Vec, indices: &mut IndexVec, diff --git a/all-is-cubes-mesh/src/block_mesh/viz.rs b/all-is-cubes-mesh/src/block_mesh/viz.rs index 381fcdf18..f56ef5d80 100644 --- a/all-is-cubes-mesh/src/block_mesh/viz.rs +++ b/all-is-cubes-mesh/src/block_mesh/viz.rs @@ -2,7 +2,7 @@ //! Intended to be used to validate that the intermediate steps are proceeding correctly, //! and just to be cool to look at. -#![allow(clippy::unused_self)] +#![cfg_attr(not(feature = "rerun"), expect(clippy::unused_self))] use all_is_cubes::block::{Evoxel, Evoxels}; use all_is_cubes::math::{Face6, FreePoint, GridCoordinate, GridPoint, Rgba, Vol}; @@ -24,7 +24,7 @@ use { /// Encapsulates all the stuff we want to *not* do if recording is disabled, and in particular, /// compiles to nothing if the "rerun" feature is not enabled. #[doc(hidden)] -#[allow(missing_debug_implementations)] +#[expect(missing_debug_implementations)] #[non_exhaustive] pub enum Viz { Disabled, @@ -36,8 +36,8 @@ pub enum Viz { /// Use [`Viz::new()`] instead of constructing this directly. #[cfg(feature = "rerun")] #[doc(hidden)] -#[allow(unnameable_types)] -#[allow(missing_debug_implementations)] +#[expect(unnameable_types)] +#[expect(missing_debug_implementations)] pub struct Inner { // Info captured from the `Evoxels` to give context to later data resolution: Option, diff --git a/all-is-cubes-mesh/src/block_vertex.rs b/all-is-cubes-mesh/src/block_vertex.rs index 8622b065c..d523dd7bd 100644 --- a/all-is-cubes-mesh/src/block_vertex.rs +++ b/all-is-cubes-mesh/src/block_vertex.rs @@ -16,7 +16,7 @@ use crate::MeshTypes; /// should identify one point in the block's 3D texture, such as `T = Point3`). /// /// [`BlockMesh`]: super::BlockMesh -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, PartialEq)] pub struct BlockVertex { /// Vertex position. @@ -51,7 +51,7 @@ impl BlockVertex { /// /// `T` is the type of texture-coordinate points being used. That is, one `T` value /// should identify one point in the block's 3D texture, such as `T = Point3`). -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Clone, Copy, Eq, PartialEq)] pub enum Coloring { /// Solid color. diff --git a/all-is-cubes-mesh/src/cache.rs b/all-is-cubes-mesh/src/cache.rs index 2715eb8c1..f468a1909 100644 --- a/all-is-cubes-mesh/src/cache.rs +++ b/all-is-cubes-mesh/src/cache.rs @@ -3,7 +3,7 @@ //! TODO: This cache is not yet used, but I expect to integrate it with `ChunkedSpaceMesh` //! eventually, replacing part or all of the `MeshJobQueue`. //! See for project details. -#![allow(dead_code)] +#![expect(dead_code)] use core::ops::Deref; use std::collections::HashMap; diff --git a/all-is-cubes-mesh/src/dynamic/chunked_mesh/tests.rs b/all-is-cubes-mesh/src/dynamic/chunked_mesh/tests.rs index 4e71577d3..c9951ae30 100644 --- a/all-is-cubes-mesh/src/dynamic/chunked_mesh/tests.rs +++ b/all-is-cubes-mesh/src/dynamic/chunked_mesh/tests.rs @@ -1,4 +1,4 @@ -#![allow(clippy::identity_op)] +#![expect(clippy::identity_op)] use alloc::vec::Vec; use std::sync::{Arc, Mutex}; @@ -149,7 +149,7 @@ fn todo_ignores_absent_chunks() { #[derive(Debug)] struct CsmTester { - #[allow( + #[expect( dead_code, reason = "Universe must be kept alive but is not read after construction" )] diff --git a/all-is-cubes-mesh/src/dynamic/job.rs b/all-is-cubes-mesh/src/dynamic/job.rs index eeec2010a..69716b6be 100644 --- a/all-is-cubes-mesh/src/dynamic/job.rs +++ b/all-is-cubes-mesh/src/dynamic/job.rs @@ -275,7 +275,7 @@ struct CompletedJobShell { /// Own this to signal that a completed job exists to be retrieved. /// It is dropped when the completed job is retrieved. - #[allow(dead_code)] + #[expect(dead_code)] counter_ticket: state::Ticket, } diff --git a/all-is-cubes-mesh/src/index_vec.rs b/all-is-cubes-mesh/src/index_vec.rs index 3fd7b2e37..e01e25f30 100644 --- a/all-is-cubes-mesh/src/index_vec.rs +++ b/all-is-cubes-mesh/src/index_vec.rs @@ -6,7 +6,6 @@ use either::Either; /// Data storage for meshes’ index lists, automatically choosing an element type which is /// large enough for the index values. #[derive(Clone, Debug, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_enums)] pub(crate) enum IndexVec { /// 16-bit indices. U16(Vec), @@ -90,7 +89,7 @@ impl IndexVec { /// Data for meshes’ index lists, which may use either 16 or 32-bit values. #[derive(Clone, Debug, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum IndexSlice<'a> { /// 16-bit indices. U16(&'a [u16]), diff --git a/all-is-cubes-mesh/src/space_mesh.rs b/all-is-cubes-mesh/src/space_mesh.rs index f512bc5c8..5cbb2abc1 100644 --- a/all-is-cubes-mesh/src/space_mesh.rs +++ b/all-is-cubes-mesh/src/space_mesh.rs @@ -668,7 +668,7 @@ pub(crate) struct Snapshot { } impl Snapshot { // TODO: To be used for background meshing - #[allow(dead_code)] + #[expect(dead_code)] pub(crate) fn new(space: &Space, bounds: GridAab) -> Snapshot { let expanded_bounds = bounds .expand(FaceMap::splat(1)) @@ -734,8 +734,8 @@ impl<'a, M: MeshTypes> GetBlockMesh<'a, M> for &'a [BlockMesh] { fn get_block_mesh( &mut self, index: BlockIndex, - #[allow(unused)] cube: Cube, - #[allow(unused)] primary: bool, + #[expect(unused)] cube: Cube, + #[expect(unused)] primary: bool, ) -> Option<&'a BlockMesh> { // TODO: Consider changing this out-of-bounds behavior to either panic or return a mesh with // some `Flaws` set. @@ -879,7 +879,7 @@ impl Clone for MeshMeta { /// Identifies a back-to-front order in which to draw triangles (of a [`SpaceMesh`]), /// based on the direction from which they are being viewed. -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub enum DepthOrdering { /// Any ordering is acceptable. diff --git a/all-is-cubes-mesh/src/tests.rs b/all-is-cubes-mesh/src/tests.rs index 92384cb49..a8047856c 100644 --- a/all-is-cubes-mesh/src/tests.rs +++ b/all-is-cubes-mesh/src/tests.rs @@ -50,7 +50,7 @@ fn v_t(position: [FreeCoordinate; 3], face: Face6, texture: [f32; 3]) -> BlockVe } /// Test helper to create [`BlockMesh`] alone without a `Space`. -#[allow(clippy::needless_pass_by_value, reason = "convenience")] +#[expect(clippy::needless_pass_by_value, reason = "convenience")] pub(crate) fn test_block_mesh(block: Block) -> BlockMesh { BlockMesh::new( &block.evaluate().unwrap(), @@ -64,7 +64,7 @@ pub(crate) fn test_block_mesh(block: Block) -> BlockMesh { /// Test helper to create [`BlockMesh`] alone without a `Space`, /// and with the transparency option set to `Threshold(0.5)`. -#[allow(clippy::needless_pass_by_value, reason = "convenience")] +#[expect(clippy::needless_pass_by_value, reason = "convenience")] fn test_block_mesh_threshold(block: Block) -> BlockMesh { BlockMesh::new( &block.evaluate().unwrap(), diff --git a/all-is-cubes-mesh/src/texture.rs b/all-is-cubes-mesh/src/texture.rs index 863881343..8e60659fd 100644 --- a/all-is-cubes-mesh/src/texture.rs +++ b/all-is-cubes-mesh/src/texture.rs @@ -18,7 +18,7 @@ pub(crate) type TextureCoordinate = f32; /// Unit-of-measure identifier used with [`euclid`](all_is_cubes::euclid) for “whole texels”. /// TODO(euclid migration): Better name, and a type alias for the point -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug)] pub enum TexelUnit {} @@ -160,7 +160,7 @@ impl Allocator for alloc::rc::Rc { /// Design note: This is an `enum` rather than a bitmask so that allocators and shaders do not /// have to support a large number of cases, but only typical ones. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum Channels { /// RGBA color (or perhaps RGB if the target does not support transparency) representing /// reflectance. @@ -243,7 +243,7 @@ pub(super) fn needed_channels(voxels: &Evoxels) -> Channels { /// Helper function to implement the typical case of copying voxels into an X-major, sRGB, RGBA /// texture. #[doc(hidden)] -#[allow( +#[expect( clippy::needless_pass_by_value, reason = "" )] @@ -285,7 +285,7 @@ pub fn copy_voxels_into_xmaj_texture( /// Used for generating textureless meshes. TODO: Modify triangulator to actually /// generate separate triangles when textures are unavailable. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct NoTextures; impl Allocator for NoTextures { @@ -301,7 +301,7 @@ impl Allocator for NoTextures { /// /// TODO: this can and should be just ! (never) when that's available in stable Rust #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum NoTexture {} impl Tile for NoTexture { diff --git a/all-is-cubes-port/src/export.rs b/all-is-cubes-port/src/export.rs index 6944dded6..09840be2d 100644 --- a/all-is-cubes-port/src/export.rs +++ b/all-is-cubes-port/src/export.rs @@ -177,7 +177,7 @@ mod tests { /// This function won't compile if `export_to_path`'s future isn't Send fn _export_to_path_future_is_send() { - #![allow(unreachable_code, clippy::diverging_sub_expression)] + #![expect(unreachable_code, clippy::diverging_sub_expression)] tokio::spawn(export_to_path( unreachable!(), unreachable!(), diff --git a/all-is-cubes-port/src/gltf.rs b/all-is-cubes-port/src/gltf.rs index 4c2c1e05a..e08c1cfb7 100644 --- a/all-is-cubes-port/src/gltf.rs +++ b/all-is-cubes-port/src/gltf.rs @@ -41,7 +41,7 @@ mod tests; /// [`MeshTypes`] implementation for glTF output. #[derive(Debug)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum GltfMt {} impl MeshTypes for GltfMt { type Vertex = GltfVertex; @@ -55,7 +55,7 @@ impl MeshTypes for GltfMt { /// These are then converted into [`gltf_json::Node`]s with animations controlling when they /// are visible. #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct MeshInstance { /// The mesh to display. pub mesh: Index, diff --git a/all-is-cubes-port/src/gltf/texture.rs b/all-is-cubes-port/src/gltf/texture.rs index 5793b1843..8801632b4 100644 --- a/all-is-cubes-port/src/gltf/texture.rs +++ b/all-is-cubes-port/src/gltf/texture.rs @@ -94,7 +94,6 @@ impl texture::Allocator for GltfTextureAllocator { // texels into 2D sections. Therefore, this is just a container for the texels, not a handle // to the actual atlas. #[derive(Clone, Debug, PartialEq)] -#[allow(clippy::derive_partial_eq_without_eq)] pub struct GltfTile { bounds: GridAab, channels: texture::Channels, @@ -157,7 +156,7 @@ impl texture::Tile for GltfTile { /// /// You should not generally need to refer to this type. #[derive(Clone, Debug, PartialEq)] -#[allow(clippy::derive_partial_eq_without_eq)] +#[expect(clippy::derive_partial_eq_without_eq)] pub struct GltfTexturePlane { plane_id: u64, bounds: GridAab, diff --git a/all-is-cubes-port/src/import.rs b/all-is-cubes-port/src/import.rs index 3ce9b1a62..504179bf5 100644 --- a/all-is-cubes-port/src/import.rs +++ b/all-is-cubes-port/src/import.rs @@ -86,7 +86,7 @@ impl all_is_cubes::save::WhenceUniverse for PortWhence { } fn can_save(&self) -> bool { - #![allow(clippy::match_like_matches_macro)] + #![expect(clippy::match_like_matches_macro)] cfg!(feature = "export") && match self.format { Format::AicJson => cfg!(feature = "native"), @@ -220,7 +220,7 @@ mod tests { /// This function won't compile if `load_universe_from_file`'s future isn't Send fn _load_universe_from_file_future_is_send() { - #![allow(unreachable_code, clippy::diverging_sub_expression)] + #![expect(unreachable_code, clippy::diverging_sub_expression)] tokio::spawn(load_universe_from_file(unreachable!(), unreachable!())); } diff --git a/all-is-cubes-port/src/mv.rs b/all-is-cubes-port/src/mv.rs index ebd85b64b..c81c4edb5 100644 --- a/all-is-cubes-port/src/mv.rs +++ b/all-is-cubes-port/src/mv.rs @@ -195,7 +195,6 @@ fn dot_vox_model_to_space( let converted_cube: Cube = Cube::from(Point3D::new(v.x, v.y, v.z).map(i32::from)); let transformed_cube = transform.transform_cube(converted_cube); - #[allow(clippy::unnecessary_lazy_evaluations, reason = "dubious positive")] let block = palette_blocks.get(v.i as usize).ok_or_else(|| { DotVoxConversionError::PaletteTooShort { len: palette_blocks.len(), diff --git a/all-is-cubes-port/src/stl.rs b/all-is-cubes-port/src/stl.rs index dbeaffccc..f47c2eae8 100644 --- a/all-is-cubes-port/src/stl.rs +++ b/all-is-cubes-port/src/stl.rs @@ -110,7 +110,6 @@ fn convert_vector(input: Vector3D) -> stl_io::Vector } #[derive(Debug)] -#[allow(clippy::exhaustive_enums)] enum StlMt {} impl mesh::MeshTypes for StlMt { diff --git a/all-is-cubes-render/benches/raytrace.rs b/all-is-cubes-render/benches/raytrace.rs index 006f55462..d09f76b99 100644 --- a/all-is-cubes-render/benches/raytrace.rs +++ b/all-is-cubes-render/benches/raytrace.rs @@ -16,7 +16,7 @@ use all_is_cubes_render::raytracer::RtRenderer; /// Non-mutated test data shared between benches struct TestData { - #[allow(dead_code, reason = "must not be dropped")] + #[expect(dead_code, reason = "must not be dropped")] universe: Universe, character: Handle, } diff --git a/all-is-cubes-render/src/camera/stdcam.rs b/all-is-cubes-render/src/camera/stdcam.rs index fab3b3b4f..7f81e4ada 100644 --- a/all-is-cubes-render/src/camera/stdcam.rs +++ b/all-is-cubes-render/src/camera/stdcam.rs @@ -15,7 +15,7 @@ use crate::camera::{Camera, GraphicsOptions, NdcPoint2, ViewTransform, Viewport} /// [`HeadlessRenderer`]: crate::HeadlessRenderer // Exhaustive: Changing this will probably be breaking anyway, until we make it a // more thorough abstraction. -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)] pub struct Layers { /// The game world. @@ -361,7 +361,7 @@ impl Clone for StandardCameras { /// Note that we may wish to revise this bundle if we start having continuously changing /// `view_transform`. #[derive(Clone, Debug)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct UiViewState { /// The [`Space`] to render as the UI. pub space: Option>, diff --git a/all-is-cubes-render/src/headless.rs b/all-is-cubes-render/src/headless.rs index 34822350d..e50b38196 100644 --- a/all-is-cubes-render/src/headless.rs +++ b/all-is-cubes-render/src/headless.rs @@ -50,7 +50,7 @@ pub trait HeadlessRenderer { // TODO: This is not very compatible with future changes, but it's not clear how to // improve extensibility. We would also like to have renderer-specific performance info. #[derive(Clone, Debug)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct Rendering { /// Width and height of the image. pub size: ImageSize, diff --git a/all-is-cubes-ui/src/apps/input.rs b/all-is-cubes-ui/src/apps/input.rs index bc7038a03..98ee77c54 100644 --- a/all-is-cubes-ui/src/apps/input.rs +++ b/all-is-cubes-ui/src/apps/input.rs @@ -68,7 +68,7 @@ impl InputProcessor { /// Constructs a new [`InputProcessor`]. /// /// Consider using [`Session`](crate::apps::Session) instead of directly calling this. - #[allow( + #[expect( clippy::new_without_default, reason = "I expect it'll grow some parameters" )] @@ -116,7 +116,6 @@ impl InputProcessor { /// Returns true if the key should go in `command_buffer`. fn is_command(key: Key) -> bool { - #[allow(clippy::match_like_matches_macro)] match key { Key::Escape => true, Key::Character(d) if d.is_ascii_digit() => true, diff --git a/all-is-cubes-ui/src/apps/session.rs b/all-is-cubes-ui/src/apps/session.rs index 3715f9233..ddb24fb2f 100644 --- a/all-is-cubes-ui/src/apps/session.rs +++ b/all-is-cubes-ui/src/apps/session.rs @@ -754,7 +754,7 @@ impl Shuttle { /// Builder for providing the configuration of a new [`Session`]. #[derive(Clone)] #[must_use] -#[allow(missing_debug_implementations)] +#[expect(missing_debug_implementations)] pub struct SessionBuilder { viewport_for_ui: Option>, @@ -939,7 +939,7 @@ struct SpaceWatchState { space: Option>, /// Gates the message forwarding from the `space` to `Session::fluff_notifier`. - #[allow(dead_code, reason = "acts upon being dropped")] + #[expect(dead_code, reason = "acts upon being dropped")] fluff_gate: listen::Gate, // /// Camera state copied from the character, for use by fluff forwarder. // camera: Camera, @@ -1091,7 +1091,7 @@ pub enum QuitCancelled { /// This type carries no information and merely exists to distinguish an intentional exit /// from accidentally returning [`()`]. #[derive(Clone, Copy, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct ExitMainTask; #[derive(Debug)] diff --git a/all-is-cubes-ui/src/ui_content/hud.rs b/all-is-cubes-ui/src/ui_content/hud.rs index 170f1c47a..d63e66c48 100644 --- a/all-is-cubes-ui/src/ui_content/hud.rs +++ b/all-is-cubes-ui/src/ui_content/hud.rs @@ -44,7 +44,6 @@ impl fmt::Debug for HudInputs { } } -#[allow(clippy::redundant_clone)] pub(super) fn new_hud_page( // TODO: mess of tightly coupled parameters character_source: ListenableSource>>, diff --git a/all-is-cubes-ui/src/ui_content/vui_manager.rs b/all-is-cubes-ui/src/ui_content/vui_manager.rs index 48b51b48f..83eded86a 100644 --- a/all-is-cubes-ui/src/ui_content/vui_manager.rs +++ b/all-is-cubes-ui/src/ui_content/vui_manager.rs @@ -53,7 +53,6 @@ pub(crate) struct Vui { viewport_source: ListenableSource, /// Size computed from `viewport_source` and compared with `PageInst`. last_ui_size: UiSize, - #[allow(dead_code)] // TODO: probably going to need this for more dynamic UIs hud_inputs: HudInputs, hud_page: PageInst, @@ -89,7 +88,7 @@ impl Vui { /// /// This is an async function for the sake of cancellation and optional cooperative /// multitasking. It may safely be blocked on from a synchronous context. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub(crate) async fn new( input_processor: &InputProcessor, character_source: ListenableSource>>, diff --git a/all-is-cubes-ui/src/vui/layout.rs b/all-is-cubes-ui/src/vui/layout.rs index 12e34455b..575adaffb 100644 --- a/all-is-cubes-ui/src/vui/layout.rs +++ b/all-is-cubes-ui/src/vui/layout.rs @@ -44,7 +44,7 @@ pub fn install_widgets( /// /// TODO: give this type and [`Layoutable`] better names #[derive(Clone, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct LayoutRequest { /// The minimum dimensions required, without which correct functionality /// is not possible. @@ -68,7 +68,7 @@ impl Fmt for LayoutRequest { /// Region a widget has been given by the layout algorithm, based on its /// [`LayoutRequest`]. #[derive(Clone, Copy, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] // TODO: constructor or something +#[expect(clippy::exhaustive_structs)] // TODO: constructor or something pub struct LayoutGrant { /// The widget may have exclusive access to this volume. pub bounds: GridAab, @@ -236,7 +236,7 @@ pub enum LayoutTree { /// Result of [`LayoutTree::perform_layout`]: specifies where items were positioned, in /// absolute coordinates (independent of the tree). #[derive(Clone, Copy, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct Positioned { #[allow(missing_docs)] pub value: W, diff --git a/all-is-cubes-ui/src/vui/widgets.rs b/all-is-cubes-ui/src/vui/widgets.rs index 8441745e7..03eb1b379 100644 --- a/all-is-cubes-ui/src/vui/widgets.rs +++ b/all-is-cubes-ui/src/vui/widgets.rs @@ -35,13 +35,13 @@ pub use all_is_cubes::content::BoxStyle; /// Generic widget controller that only does something on `initialize()`. #[derive(Clone, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct OneshotController(pub Option); impl OneshotController { /// Creates a [`OneshotController`] that will execute the given transaction once, /// then do nothing. - #[allow(clippy::new_ret_no_self)] + #[expect(clippy::new_ret_no_self)] pub fn new(transaction: vui::WidgetTransaction) -> Box { Box::new(Self(Some(transaction))) } diff --git a/all-is-cubes-ui/src/vui/widgets/button.rs b/all-is-cubes-ui/src/vui/widgets/button.rs index e9574f300..ed98e8520 100644 --- a/all-is-cubes-ui/src/vui/widgets/button.rs +++ b/all-is-cubes-ui/src/vui/widgets/button.rs @@ -494,7 +494,7 @@ pub(crate) enum ButtonIcon<'a> { } /// TODO: document, refine, and make public -#[allow(clippy::needless_pass_by_value, reason = "convenience")] +#[expect(clippy::needless_pass_by_value, reason = "convenience")] pub(crate) fn make_button_label_block( txn: &mut UniverseTransaction, name: &str, diff --git a/all-is-cubes-ui/src/vui/widgets/text.rs b/all-is-cubes-ui/src/vui/widgets/text.rs index 85bc2d531..0350342d3 100644 --- a/all-is-cubes-ui/src/vui/widgets/text.rs +++ b/all-is-cubes-ui/src/vui/widgets/text.rs @@ -21,7 +21,7 @@ use crate::vui::{self, widgets, LayoutGrant, LayoutRequest, Layoutable, Widget, /// /// TODO: Give this a more precise name, and a nice constructor... #[derive(Clone, Debug)] -#[allow(clippy::exhaustive_structs)] // TODO: find a better strategy +#[expect(clippy::exhaustive_structs)] // TODO: find a better strategy pub struct LargeText { /// Text to be displayed. pub text: ArcStr, diff --git a/all-is-cubes-ui/src/vui/widgets/theme.rs b/all-is-cubes-ui/src/vui/widgets/theme.rs index bc9669b0b..3dd4b90fe 100644 --- a/all-is-cubes-ui/src/vui/widgets/theme.rs +++ b/all-is-cubes-ui/src/vui/widgets/theme.rs @@ -254,7 +254,7 @@ impl WidgetBlocks { /// The state of a mouse button's relationship to a toolbar slot. #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Exhaust)] #[doc(hidden)] // public only because WidgetBlocks is -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum ToolbarButtonState { /// This button is not mapped to this toolbar slot. Unmapped, diff --git a/all-is-cubes-wasm/src/js_bindings.rs b/all-is-cubes-wasm/src/js_bindings.rs index d1f89ca48..8b059c21f 100644 --- a/all-is-cubes-wasm/src/js_bindings.rs +++ b/all-is-cubes-wasm/src/js_bindings.rs @@ -1,10 +1,5 @@ //! Bindings for our own JS code. -#![allow( - clippy::empty_docs, - reason = "false positive " -)] - use wasm_bindgen::prelude::wasm_bindgen; use web_sys::HtmlCanvasElement; diff --git a/all-is-cubes-wasm/src/lib.rs b/all-is-cubes-wasm/src/lib.rs index 36126ac18..14bee5bc2 100644 --- a/all-is-cubes-wasm/src/lib.rs +++ b/all-is-cubes-wasm/src/lib.rs @@ -16,7 +16,7 @@ mod init; pub mod js_bindings; #[cfg(any(target_family = "wasm", test))] mod url_params; -#[cfg_attr(not(target_family = "wasm"), allow(unused))] +#[cfg_attr(not(target_family = "wasm"), expect(unused))] mod web_glue; #[cfg(target_family = "wasm")] mod web_session; diff --git a/all-is-cubes-wasm/src/url_params.rs b/all-is-cubes-wasm/src/url_params.rs index db8d59112..6840a2b1b 100644 --- a/all-is-cubes-wasm/src/url_params.rs +++ b/all-is-cubes-wasm/src/url_params.rs @@ -11,7 +11,7 @@ use all_is_cubes_content::UniverseTemplate; use all_is_cubes_render::camera::GraphicsOptions; #[derive(Clone, Debug, PartialEq)] -#[allow(clippy::derive_partial_eq_without_eq)] +#[expect(clippy::derive_partial_eq_without_eq)] pub struct OptionsInUrl { pub template: UniverseTemplate, pub graphics_options: GraphicsOptions, diff --git a/all-is-cubes-wasm/src/web_session.rs b/all-is-cubes-wasm/src/web_session.rs index 9bd437c49..e44b21424 100644 --- a/all-is-cubes-wasm/src/web_session.rs +++ b/all-is-cubes-wasm/src/web_session.rs @@ -29,7 +29,6 @@ use crate::web_glue::{ pub(crate) type Session = all_is_cubes_ui::apps::Session; -#[allow(clippy::large_enum_variant)] pub(crate) enum WebRenderer { Wgpu(in_wgpu::SurfaceRenderer), } diff --git a/all-is-cubes/src/behavior.rs b/all-is-cubes/src/behavior.rs index 804fa5229..cb50713ec 100644 --- a/all-is-cubes/src/behavior.rs +++ b/all-is-cubes/src/behavior.rs @@ -407,7 +407,6 @@ impl fmt::Debug for BehaviorSetEntry { } impl PartialEq for BehaviorSetEntry { - #[allow(ambiguous_wide_pointer_comparisons)] // The hazards should be okay for this use case fn eq(&self, other: &Self) -> bool { self.attachment == other.attachment && Arc::ptr_eq(&self.behavior, &other.behavior) } @@ -579,7 +578,6 @@ impl Transaction for BehaviorSetTransaction { type Output = transaction::NoOutput; type Mismatch = BehaviorTransactionMismatch; - #[allow(ambiguous_wide_pointer_comparisons)] // The hazards should be okay for this use case fn check(&self, target: &BehaviorSet) -> Result { let Self { replace, insert } = self; // TODO: need to compare replacement preconditions @@ -734,7 +732,6 @@ impl PartialEq for BehaviorSetTransaction { } impl PartialEq for Replace { // Manual implementation to avoid bounds on `H` and to implement the partiality (comparing pointers instead of values). - #[allow(ambiguous_wide_pointer_comparisons)] // The hazards should be okay for this use case fn eq(&self, other: &Self) -> bool { let Self { old: old1, @@ -1028,8 +1025,6 @@ mod tests { #[test] fn query() { - #![allow(trivial_casts)] - #[derive(Debug, Eq, PartialEq)] struct Expected; #[derive(Debug, Eq, PartialEq)] diff --git a/all-is-cubes/src/block.rs b/all-is-cubes/src/block.rs index 3fdcb52e1..5a648c96f 100644 --- a/all-is-cubes/src/block.rs +++ b/all-is-cubes/src/block.rs @@ -212,7 +212,7 @@ pub enum Primitive { /// /// [intensive properties]: https://en.wikipedia.org/wiki/Intensive_and_extensive_properties #[derive(Clone, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct Atom { /// The color exhibited by diffuse reflection from this block. /// @@ -1102,7 +1102,7 @@ pub struct BlockChange { } impl BlockChange { - #[allow(clippy::new_without_default)] + #[expect(clippy::new_without_default)] #[allow(missing_docs)] // TODO: why is this public, anyway? pub fn new() -> BlockChange { BlockChange { _not_public: () } diff --git a/all-is-cubes/src/block/attributes.rs b/all-is-cubes/src/block/attributes.rs index c92f2b88c..bca6a1732 100644 --- a/all-is-cubes/src/block/attributes.rs +++ b/all-is-cubes/src/block/attributes.rs @@ -22,7 +22,7 @@ use crate::{ /// `BlockAttributes::default()` will produce a reasonable set of defaults for “ordinary” /// blocks. #[derive(Clone, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_structs)] // TODO: Make this non_exhaustive but give users a way to construct it easily, possibly via BlockBuilder. +#[expect(clippy::exhaustive_structs)] // TODO: Make this non_exhaustive but give users a way to construct it easily, possibly via BlockBuilder. pub struct BlockAttributes { /// The name that should be displayed to players. /// @@ -446,7 +446,7 @@ impl ops::BitOr for AnimationChange { /// Stored in [`BlockAttributes`]. #[derive(Clone, Debug, Eq, Hash, PartialEq)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[allow(clippy::exhaustive_structs, reason = "will deliberately break")] +#[expect(clippy::exhaustive_structs, reason = "will deliberately break")] pub struct TickAction { /// Operation to perform on the schedule. pub operation: Operation, @@ -519,7 +519,7 @@ mod tests { #[test] fn debug() { let default = BlockAttributes::default; - #[allow(clippy::needless_pass_by_value)] + #[expect(clippy::needless_pass_by_value)] fn debug(a: BlockAttributes) -> String { format!("{a:?}") } diff --git a/all-is-cubes/src/block/block_def.rs b/all-is-cubes/src/block/block_def.rs index 5bb435928..c45d7bf75 100644 --- a/all-is-cubes/src/block/block_def.rs +++ b/all-is-cubes/src/block/block_def.rs @@ -59,7 +59,7 @@ struct BlockDefState { listeners_ok: bool, /// Gate with which to interrupt previous listening to a contained block. - #[allow(unused, reason = "used only for its `Drop` behavior")] + #[expect(unused, reason = "used only for its `Drop` behavior")] block_listen_gate: Gate, } diff --git a/all-is-cubes/src/block/builder.rs b/all-is-cubes/src/block/builder.rs index 68001652f..653abe3f0 100644 --- a/all-is-cubes/src/block/builder.rs +++ b/all-is-cubes/src/block/builder.rs @@ -377,7 +377,7 @@ impl From for BlockBuilder { /// Placeholder type for an incomplete [`BlockBuilder`]'s content. The builder /// cannot create an actual block until this is replaced. -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)] pub struct NeedsPrimitive; diff --git a/all-is-cubes/src/block/eval/control.rs b/all-is-cubes/src/block/eval/control.rs index d82fd63ca..775857df2 100644 --- a/all-is-cubes/src/block/eval/control.rs +++ b/all-is-cubes/src/block/eval/control.rs @@ -15,7 +15,6 @@ use crate::universe::Handle; use crate::universe::HandleError; /// Parameters to [`Block::evaluate2()`] to choose which information to compute. -#[allow(clippy::exhaustive_structs)] #[derive(Clone, Debug)] pub(crate) struct EvalFilter { /// If true, don't actually evaluate, but return a placeholder value and do listen. diff --git a/all-is-cubes/src/block/eval/tests.rs b/all-is-cubes/src/block/eval/tests.rs index 30ee82f57..0fe53b038 100644 --- a/all-is-cubes/src/block/eval/tests.rs +++ b/all-is-cubes/src/block/eval/tests.rs @@ -130,7 +130,7 @@ fn evoxel_size() { #[test] fn visible_or_animated() { - #[allow(clippy::needless_pass_by_value)] + #[expect(clippy::needless_pass_by_value)] fn va(block: Block) -> bool { block.evaluate().unwrap().visible_or_animated() } diff --git a/all-is-cubes/src/block/modifier/composite.rs b/all-is-cubes/src/block/modifier/composite.rs index 3975c58f7..c6f229648 100644 --- a/all-is-cubes/src/block/modifier/composite.rs +++ b/all-is-cubes/src/block/modifier/composite.rs @@ -431,7 +431,7 @@ impl CompositeOperator { /// Called by [`Self::blend_evoxel()`] to handle properties that can be described as /// “present or absent” binary flags. - #[allow(clippy::needless_bitwise_bool)] // ideally this would be branchless… + #[expect(clippy::needless_bitwise_bool)] // ideally this would be branchless… fn blend_binary(self, source: bool, destination: bool) -> bool { match self { Self::Over => source | destination, @@ -468,7 +468,7 @@ impl CompositeOperator { /// Returns whether this operator’s effects are independent of how the input blocks are /// rotated. - #[allow(clippy::unused_self)] + #[expect(clippy::unused_self)] fn rotationally_symmetric(self) -> bool { true } diff --git a/all-is-cubes/src/block/tests.rs b/all-is-cubes/src/block/tests.rs index 1a89ae316..d3a56130e 100644 --- a/all-is-cubes/src/block/tests.rs +++ b/all-is-cubes/src/block/tests.rs @@ -5,8 +5,6 @@ //! * [`super::builder`] //! * [`super::modifier`] -#![allow(clippy::bool_assert_comparison)] - use euclid::Vector3D; use pretty_assertions::assert_eq; diff --git a/all-is-cubes/src/block/text.rs b/all-is-cubes/src/block/text.rs index e8c8ef5bc..079c3c1e2 100644 --- a/all-is-cubes/src/block/text.rs +++ b/all-is-cubes/src/block/text.rs @@ -618,7 +618,7 @@ impl universe::VisitHandles for Font { /// How a [`Text`] is to be positioned within a block. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[allow( +#[expect( clippy::exhaustive_structs, reason = "TODO: probably want to do something else" )] diff --git a/all-is-cubes/src/camera.rs b/all-is-cubes/src/camera.rs index 43ce66fed..d7e1250ba 100644 --- a/all-is-cubes/src/camera.rs +++ b/all-is-cubes/src/camera.rs @@ -75,7 +75,6 @@ pub struct Camera { } /// Basic creation and mutation. -#[allow(clippy::cast_lossless)] impl Camera { /// Create a camera which has /// @@ -143,7 +142,6 @@ impl Camera { /// Besides controlling rendering, this is used to determine world coordinates for purposes /// of [`view_position()`](Self::view_position) and /// [`project_ndc_into_world()`](Self::project_ndc_into_world). - #[allow(clippy::float_cmp)] pub fn set_view_transform(&mut self, eye_to_world_transform: ViewTransform) { if eye_to_world_transform.to_untyped() == self.eye_to_world_transform.to_untyped() { return; @@ -429,20 +427,20 @@ impl Camera { /// the space of camera-relative coordinates that are *not* perspective-projected. /// /// +X is right, +Y is up, +Z is towards-the-viewer (right-handed coordinates). -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug, Eq, PartialEq)] pub enum Eye {} /// Unit-of-measure type for vectors representing the on-screen dimensions of a [`Viewport`], /// which may be different from the “physical” pixels of the image rendered to it. -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug, Eq, PartialEq)] pub enum NominalPixel {} /// Unit-of-measure type for vectors representing the width and height of an image. /// /// Used in [`Viewport::framebuffer_size`]. -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug, Eq, PartialEq)] pub enum ImagePixel {} @@ -453,7 +451,7 @@ pub enum ImagePixel {} /// zero is the center of the screen; /// and z has the range 0 (nearest) to 1 (farthest), /// and is image depth rather than an equivalent third spatial axis. -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug, Eq, PartialEq)] pub enum Ndc {} @@ -472,7 +470,7 @@ pub type ImageSize = Size2D; /// Viewport dimensions for rendering and UI layout with the correct resolution and /// aspect ratio. -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] pub struct Viewport { diff --git a/all-is-cubes/src/camera/graphics_options.rs b/all-is-cubes/src/camera/graphics_options.rs index 00ffd36ef..42222057a 100644 --- a/all-is-cubes/src/camera/graphics_options.rs +++ b/all-is-cubes/src/camera/graphics_options.rs @@ -18,7 +18,7 @@ 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)] -#[allow( +#[expect( clippy::unsafe_derive_deserialize, reason = "false positive from notnan! macro" )] diff --git a/all-is-cubes/src/character.rs b/all-is-cubes/src/character.rs index 68300b23a..b4789ebfc 100644 --- a/all-is-cubes/src/character.rs +++ b/all-is-cubes/src/character.rs @@ -722,7 +722,6 @@ impl CharacterTransaction { } } -#[allow(clippy::type_complexity)] impl Transaction for CharacterTransaction { type Target = Character; type CommitCheck = ( @@ -871,7 +870,7 @@ impl core::error::Error for CharacterTransactionConflict { /// Description of a change to a [`Character`] for use in listeners. #[derive(Clone, Debug, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_enums)] // any change will probably be breaking anyway +#[expect(clippy::exhaustive_enums)] // any change will probably be breaking anyway pub enum CharacterChange { /// Inventory contents. Inventory(inv::InventoryChange), diff --git a/all-is-cubes/src/chunking.rs b/all-is-cubes/src/chunking.rs index a6412d4c8..0ce9dae1d 100644 --- a/all-is-cubes/src/chunking.rs +++ b/all-is-cubes/src/chunking.rs @@ -26,12 +26,11 @@ use crate::math::{ }; /// Unit-of-measure type for chunk positions *not* tracking the chunk size in the type. -#[allow(clippy::exhaustive_enums)] #[derive(Debug)] enum WholeChunk {} /// Unit-of-measure/coordinate-system type for cubes within a chunk (range `0..CHUNK_SIZE`) -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug)] pub enum ChunkRelative {} @@ -48,7 +47,7 @@ type Ccv = Vector3D; /// /// The consequences are unspecified if `CHUNK_SIZE` is not positive. #[derive(Clone, Copy, Eq, Hash, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct ChunkPos(pub Cube); impl fmt::Debug for ChunkPos { diff --git a/all-is-cubes/src/content/draw_box.rs b/all-is-cubes/src/content/draw_box.rs index 3281ba224..96e425708 100644 --- a/all-is-cubes/src/content/draw_box.rs +++ b/all-is-cubes/src/content/draw_box.rs @@ -240,9 +240,9 @@ impl BoxStyle { /// extending in the [`+Z`](crate::math::Face6::PZ) direction. /// It should be symmetric about the X-Y=0 plane, and will be rotated and mirrored /// to make the other forms. - #[allow(clippy::needless_pass_by_value, reason = "consistency")] + #[expect(clippy::needless_pass_by_value, reason = "consistency")] pub fn from_composited_corner_and_edge(corner_block: Block, line_section_block: Block) -> Self { - #![allow(non_snake_case)] + #![expect(non_snake_case)] let corner_x = corner_block.clone().rotate(GridRotation::RxYZ); let corner_y = corner_block.clone().rotate(GridRotation::RXyZ); diff --git a/all-is-cubes/src/content/load_image.rs b/all-is-cubes/src/content/load_image.rs index 4d3992320..408adc3f6 100644 --- a/all-is-cubes/src/content/load_image.rs +++ b/all-is-cubes/src/content/load_image.rs @@ -30,7 +30,7 @@ type Srgba = [u8; 4]; /// Adapter from [`png_decoder`] decoded images to [`embedded_graphics::Drawable`]. #[doc(hidden)] // still experimental API -#[allow(missing_debug_implementations)] +#[expect(missing_debug_implementations)] pub struct PngAdapter<'a> { width: i32, height: i32, diff --git a/all-is-cubes/src/drawing.rs b/all-is-cubes/src/drawing.rs index 48db2edfa..e10ff03be 100644 --- a/all-is-cubes/src/drawing.rs +++ b/all-is-cubes/src/drawing.rs @@ -75,9 +75,6 @@ pub fn rectangle_to_aab(rectangle: Rectangle, transform: Gridgid, max_brush: Gri #![allow(unknown_lints)] // TODO: remove after Rust 1.82 is released #![allow(clippy::too_long_first_doc_paragraph)] // TODO: find better phrasing - // TODO: propagate numeric overflow cases - #![allow(clippy::cast_possible_wrap)] - if rectangle.size.width == 0 || rectangle.size.height == 0 { // Handle zero-sized rectangles — they don't draw any pixels, so don't enlarge them diff --git a/all-is-cubes/src/inv/inventory.rs b/all-is-cubes/src/inv/inventory.rs index 5116f5b8f..5ec481461 100644 --- a/all-is-cubes/src/inv/inventory.rs +++ b/all-is-cubes/src/inv/inventory.rs @@ -326,7 +326,7 @@ impl StackLimit { /// The output type is the change notification which should be passed on after commit, /// if any change is made. #[derive(Clone, Debug, Default, PartialEq)] -#[allow(clippy::derive_partial_eq_without_eq)] +#[expect(clippy::derive_partial_eq_without_eq)] #[must_use] pub struct InventoryTransaction { replace: BTreeMap, diff --git a/all-is-cubes/src/inv/tool.rs b/all-is-cubes/src/inv/tool.rs index 2a42cf88f..a4f8c6b36 100644 --- a/all-is-cubes/src/inv/tool.rs +++ b/all-is-cubes/src/inv/tool.rs @@ -314,7 +314,7 @@ impl VisitHandles for Tool { /// This is intended to provide future extensibility compared to having a complex /// parameter list for `Tool::use_tool`. #[derive(Debug)] -#[allow(clippy::exhaustive_structs, reason = "TODO: should be non_exhaustive")] +#[expect(clippy::exhaustive_structs, reason = "TODO: should be non_exhaustive")] pub struct ToolInput { /// Cursor identifying block(s) to act on. If [`None`] then the tool was used while /// pointing at nothing or by an agent without an ability to aim. @@ -700,7 +700,7 @@ mod tests { } #[derive(Clone, Debug)] - #[allow(dead_code, reason = "fields only used in Debug if an expect() fails")] + #[expect(dead_code, reason = "fields only used in Debug if an expect() fails")] enum EucError { Use(ToolError), Commit(transaction::ExecuteError), diff --git a/all-is-cubes/src/linking.rs b/all-is-cubes/src/linking.rs index 3f8d09551..8efad5f3e 100644 --- a/all-is-cubes/src/linking.rs +++ b/all-is-cubes/src/linking.rs @@ -272,7 +272,7 @@ impl<'provider, E: Exhaust + fmt::Debug + Clone + Eq + Hash, V> IntoIterator } /// Iterator returned by [`Provider::iter()`]. -#[allow(missing_debug_implementations)] +#[expect(missing_debug_implementations)] pub struct ModuleIter<'provider, E: Exhaust, V> { /// Using the `Exhaust` iterator instead of the `HashMap` iterator guarantees a deterministic /// iteration order. (We don't currently publicly promise that, though.) @@ -321,7 +321,6 @@ impl Error for ProviderError {} /// member was to be generated but failed. #[derive(Debug)] pub struct GenError { - #[cfg_attr(not(feature = "std"), allow(dead_code))] detail: InGenError, for_object: Option, } @@ -594,7 +593,7 @@ mod tests { } #[test] - #[allow(clippy::try_err)] + #[expect(clippy::try_err)] fn gen_error_composition() { // TODO: this isn't the greatest example situation fn a() -> Result<(), GenError> { diff --git a/all-is-cubes/src/listen.rs b/all-is-cubes/src/listen.rs index e9be2b17f..8af4d817b 100644 --- a/all-is-cubes/src/listen.rs +++ b/all-is-cubes/src/listen.rs @@ -399,7 +399,6 @@ mod tests { } #[test] - #[allow(ambiguous_wide_pointer_comparisons)] fn erased_listener() { let sink = Sink::new(); let listener: DynListener<&str> = sink.listener().erased(); diff --git a/all-is-cubes/src/listen/cell.rs b/all-is-cubes/src/listen/cell.rs index ad0a591b5..f45984336 100644 --- a/all-is-cubes/src/listen/cell.rs +++ b/all-is-cubes/src/listen/cell.rs @@ -182,7 +182,7 @@ impl ListenableCellWithLocal { self.value = value; } - #[allow(clippy::should_implement_trait)] // TODO: consider renaming + #[expect(clippy::should_implement_trait)] // TODO: consider renaming pub fn borrow(&self) -> &T { &self.value } diff --git a/all-is-cubes/src/listen/listeners.rs b/all-is-cubes/src/listen/listeners.rs index 4153f0e30..2b690d680 100644 --- a/all-is-cubes/src/listen/listeners.rs +++ b/all-is-cubes/src/listen/listeners.rs @@ -13,7 +13,7 @@ use crate::util::maybe_sync::{RwLock, SendSyncIfStd}; /// A [`Listener`] which discards all messages. /// /// Use this when a [`Listener`] is demanded, but there is nothing it should do. -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct NullListener; diff --git a/all-is-cubes/src/op.rs b/all-is-cubes/src/op.rs index ec8b92d9c..d66b4288d 100644 --- a/all-is-cubes/src/op.rs +++ b/all-is-cubes/src/op.rs @@ -96,7 +96,7 @@ impl Operation { /// /// Note that lack of error does not guarantee that the returned transaction will /// succeed. TODO: Explain how the two kinds of errors should be reported. - #[allow(clippy::only_used_in_recursion)] // TODO: Inventory not used *yet*. + #[expect(clippy::only_used_in_recursion)] // TODO: Inventory not used *yet*. pub(crate) fn apply( &self, space: &Space, diff --git a/all-is-cubes/src/physics.rs b/all-is-cubes/src/physics.rs index 45f9d55fd..d414d0525 100644 --- a/all-is-cubes/src/physics.rs +++ b/all-is-cubes/src/physics.rs @@ -14,11 +14,11 @@ mod tests; pub(crate) const POSITION_EPSILON: FreeCoordinate = 1e-6 * 1e-6; /// Unit-of-measure type for vectors that are velocity in cubes/s. -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug, Eq, PartialEq)] pub enum Velocity {} /// Unit-of-measure type for vectors that are acceleration in cubes/s². -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Debug, Eq, PartialEq)] pub enum Acceleration {} diff --git a/all-is-cubes/src/physics/collision.rs b/all-is-cubes/src/physics/collision.rs index 1a04704ee..16c980117 100644 --- a/all-is-cubes/src/physics/collision.rs +++ b/all-is-cubes/src/physics/collision.rs @@ -38,7 +38,7 @@ macro_rules! println_escape_debug { /// /// This type is designed to be comparable/hashable to deduplicate contacts. #[derive(Clone, Copy, Eq, Hash, PartialEq)] -#[allow( +#[expect( clippy::exhaustive_enums, reason = "any change will probably be breaking anyway" )] @@ -805,7 +805,7 @@ mod tests { ); } - #[allow(clippy::needless_pass_by_value, reason = "convenience")] + #[expect(clippy::needless_pass_by_value, reason = "convenience")] fn collide_along_ray_tester( initial_y: FreeCoordinate, block_gen: fn(&mut Universe) -> [Block; 2], @@ -971,7 +971,7 @@ mod tests { ); } - #[allow(clippy::needless_pass_by_value, reason = "convenience")] + #[expect(clippy::needless_pass_by_value, reason = "convenience")] fn escape_along_ray_tester( ray: Ray, block_gen: fn(&mut Universe) -> [Block; 2], diff --git a/all-is-cubes/src/raytracer/text.rs b/all-is-cubes/src/raytracer/text.rs index 276442eac..ab2497ef7 100644 --- a/all-is-cubes/src/raytracer/text.rs +++ b/all-is-cubes/src/raytracer/text.rs @@ -17,7 +17,7 @@ use crate::space::{Space, SpaceBlockData}; /// If you are using [`CharacterBuf`], use this [`RtBlockData`] implementation. // TODO: better name #[derive(Clone, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] // TODO: field would ideally be private pub struct CharacterRtData(pub Substr); @@ -46,7 +46,7 @@ impl RtBlockData for CharacterRtData { /// Implements [`Accumulate`] for text output: captures the first characters of block names /// rather than colors. #[derive(Clone, Debug, Default, PartialEq)] -#[allow(clippy::derive_partial_eq_without_eq)] +#[expect(clippy::derive_partial_eq_without_eq)] pub struct CharacterBuf { /// Text to draw, if determined yet. hit_text: Option, diff --git a/all-is-cubes/src/raytracer/updating.rs b/all-is-cubes/src/raytracer/updating.rs index b39222903..945cfcf13 100644 --- a/all-is-cubes/src/raytracer/updating.rs +++ b/all-is-cubes/src/raytracer/updating.rs @@ -285,7 +285,7 @@ mod tests { .get() .to_text::(&self.camera, "\n") .to_string(); - #[allow(clippy::unit_arg)] + #[expect(clippy::unit_arg)] let image_fresh = SpaceRaytracer::::new( &self.space.read().unwrap(), self.graphics_options.snapshot(), diff --git a/all-is-cubes/src/rerun_glue.rs b/all-is-cubes/src/rerun_glue.rs index 338fc61e3..eb507a8b5 100644 --- a/all-is-cubes/src/rerun_glue.rs +++ b/all-is-cubes/src/rerun_glue.rs @@ -13,7 +13,7 @@ pub use re_types::{archetypes, components, view_coordinates}; /// Information that an entity or parent of entities can store in order to know where to /// send their Rerun logging data. #[derive(Clone)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct Destination { pub stream: RecordingStream, pub path: EntityPath, @@ -55,7 +55,7 @@ impl Destination { self.stream.is_enabled() } - #[allow(clippy::unused_self)] + #[expect(clippy::unused_self)] fn catch(&self, f: impl FnOnce() -> RecordingStreamResult<()>) { match f() { Ok(()) => (), diff --git a/all-is-cubes/src/save/schema.rs b/all-is-cubes/src/save/schema.rs index de359c89d..ee715f1f6 100644 --- a/all-is-cubes/src/save/schema.rs +++ b/all-is-cubes/src/save/schema.rs @@ -123,7 +123,7 @@ pub(crate) struct BlockAttributesV1Ser<'a> { fn return_true() -> bool { true } -#[allow(clippy::trivially_copy_pass_by_ref)] +#[expect(clippy::trivially_copy_pass_by_ref)] fn is_true(value: &bool) -> bool { *value } diff --git a/all-is-cubes/src/save/tests.rs b/all-is-cubes/src/save/tests.rs index c85011dad..60063d1af 100644 --- a/all-is-cubes/src/save/tests.rs +++ b/all-is-cubes/src/save/tests.rs @@ -27,7 +27,7 @@ use crate::{behavior, color_block, op}; #[track_caller] /// Serialize and deserialize and assert the value is equal. -#[allow(clippy::needless_pass_by_value, reason = "convenience")] +#[expect(clippy::needless_pass_by_value, reason = "convenience")] fn assert_round_trip_value(value: &T, expected_json: serde_json::Value) where T: PartialEq + fmt::Debug + serde::Serialize + serde::de::DeserializeOwned, @@ -47,7 +47,7 @@ where /// Deserialize and serialize and assert the JSON is equal. /// Returns the deserialized value. #[track_caller] -#[allow(clippy::needless_pass_by_value, reason = "convenience")] +#[expect(clippy::needless_pass_by_value, reason = "convenience")] fn assert_round_trip_json(json: serde_json::Value) -> T where T: fmt::Debug + serde::Serialize + serde::de::DeserializeOwned, @@ -64,7 +64,7 @@ where /// This is useful in lieu of [`assert_round_trip_value`] for when the values are /// necessarily unequal (anything involving [`Handle`]s). #[track_caller] -#[allow(clippy::needless_pass_by_value, reason = "convenience")] +#[expect(clippy::needless_pass_by_value, reason = "convenience")] fn assert_serdeser(value: &T, expected_json: serde_json::Value) -> T where T: fmt::Debug + serde::Serialize + serde::de::DeserializeOwned, diff --git a/all-is-cubes/src/space.rs b/all-is-cubes/src/space.rs index ccdcee7c6..61f6b3cd0 100644 --- a/all-is-cubes/src/space.rs +++ b/all-is-cubes/src/space.rs @@ -1202,7 +1202,7 @@ impl fmt::Display for SetCubeError { /// Description of a change to a [`Space`] for use in listeners. #[derive(Clone, Debug, Eq, Hash, PartialEq)] -#[allow( +#[expect( clippy::exhaustive_enums, reason = "any change will probably be breaking anyway" )] @@ -1356,7 +1356,7 @@ impl Fmt for SpaceStepInfo { /// /// [`Tool::Activate`]: crate::inv::Tool::Activate #[derive(Clone, Debug, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct ActivatableRegion { /// The function to call when this region is activated. pub effect: EphemeralOpaque, diff --git a/all-is-cubes/src/space/builder.rs b/all-is-cubes/src/space/builder.rs index e42a80814..350e68c4e 100644 --- a/all-is-cubes/src/space/builder.rs +++ b/all-is-cubes/src/space/builder.rs @@ -278,7 +278,7 @@ impl SpaceBuilderBounds for Vol<()> { mod sbb { use super::*; #[doc(hidden)] - #[allow(unnameable_types)] + #[expect(unnameable_types)] pub trait SbbSealed {} impl SbbSealed for () {} impl SbbSealed for Vol<()> {} @@ -300,7 +300,7 @@ impl<'a> arbitrary::Arbitrary<'a> for Space { // Generate some blocks to put in the space let mut blocks = alloc::vec::Vec::from(make_some_blocks::<2>()); // TODO: generate arbitrary blocks with attributes - #[allow(clippy::same_item_push)] + #[expect(clippy::same_item_push)] for _ in 0..6 { // Make it probable that blocks are AIR blocks.push(AIR); diff --git a/all-is-cubes/src/space/light/data.rs b/all-is-cubes/src/space/light/data.rs index fc1cc3d1d..c0a1a408c 100644 --- a/all-is-cubes/src/space/light/data.rs +++ b/all-is-cubes/src/space/light/data.rs @@ -6,7 +6,7 @@ use euclid::default::Vector3D; /// Acts as polyfill for float methods #[cfg(not(feature = "std"))] -#[allow(unused_imports)] +#[expect(unused_imports)] use num_traits::float::Float as _; use crate::math::{NotNan, Rgb}; diff --git a/all-is-cubes/src/space/light/debug.rs b/all-is-cubes/src/space/light/debug.rs index 2cbd08eab..9ec20c860 100644 --- a/all-is-cubes/src/space/light/debug.rs +++ b/all-is-cubes/src/space/light/debug.rs @@ -13,7 +13,7 @@ use crate::util::MapExtend; /// Trait used to encourage the generation of with-debug-info and without-info versions /// of the lighting algorithm. -#[allow(unnameable_types, reason = "sealed trait")] +#[expect(unnameable_types, reason = "sealed trait")] pub trait LightComputeOutput { type RayInfoBuffer: Default; fn new(cube: Cube, result: PackedLight, rays: Self::RayInfoBuffer) -> Self; @@ -41,7 +41,7 @@ impl LightComputeOutput for LightUpdateCubeInfo { /// Diagnostic data describing the details of the light calculation for one cube. #[derive(Clone, Debug)] #[non_exhaustive] -#[allow(dead_code, reason = "fields used for Debug printing")] +#[expect(dead_code, reason = "fields used for Debug printing")] pub struct LightUpdateCubeInfo { pub(crate) cube: Cube, pub(crate) result: PackedLight, @@ -69,10 +69,10 @@ impl Geometry for LightUpdateCubeInfo { } #[derive(Clone, Copy, Debug)] -#[allow(unnameable_types)] // +#[expect(unnameable_types)] // pub struct LightUpdateRayInfo { pub(crate) ray: Ray, - #[allow( + #[expect( dead_code, reason = "field used for Debug printing but not visualized yet" )] diff --git a/all-is-cubes/src/space/light/updater.rs b/all-is-cubes/src/space/light/updater.rs index fee9c0577..7261f1dd5 100644 --- a/all-is-cubes/src/space/light/updater.rs +++ b/all-is-cubes/src/space/light/updater.rs @@ -672,7 +672,7 @@ impl LightBuffer { /// Note: to avoid redundant lookups as a ray proceeds, `current_light` is used only to fill /// `light_ahead_cache` or `light_behind_cache`. #[inline] - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn traverse( &mut self, ray_state: &mut LightRayState, @@ -839,7 +839,7 @@ impl LightBuffer { /// TODO: better name #[derive(Clone, Debug)] #[doc(hidden)] // used for debug rendering -#[allow(unnameable_types)] +#[expect(unnameable_types)] pub struct ComputedLight { pub cube: Cube, diff --git a/all-is-cubes/src/space/palette.rs b/all-is-cubes/src/space/palette.rs index aa4d51b7c..c3a78ecbd 100644 --- a/all-is-cubes/src/space/palette.rs +++ b/all-is-cubes/src/space/palette.rs @@ -414,7 +414,7 @@ pub struct SpaceBlockData { /// Number of uses of this block in the space. count: usize, pub(super) evaluated: EvaluatedBlock, - #[allow(dead_code, reason = "Used only for its `Drop`")] + #[expect(dead_code, reason = "Used only for its `Drop`")] block_listen_gate: Option, } diff --git a/all-is-cubes/src/transaction.rs b/all-is-cubes/src/transaction.rs index 0266993ee..5d0cda773 100644 --- a/all-is-cubes/src/transaction.rs +++ b/all-is-cubes/src/transaction.rs @@ -209,7 +209,7 @@ pub trait Merge: Sized { } /// Error type from [`Transaction::execute()`] and [`Transactional::transact()`]. -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum ExecuteError { /// A conflict was discovered between parts that were to be assembled into the transaction. /// @@ -450,7 +450,7 @@ pub(crate) fn merge_option(this: &mut Option, other: Option, if_both: f /// For use with `merge_option()`. #[track_caller] -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] pub(crate) fn panic_if_not_equal(a: T, b: T) -> T { if a == b { a diff --git a/all-is-cubes/src/transaction/generic.rs b/all-is-cubes/src/transaction/generic.rs index 6a320012d..adfe8756c 100644 --- a/all-is-cubes/src/transaction/generic.rs +++ b/all-is-cubes/src/transaction/generic.rs @@ -254,7 +254,7 @@ macro_rules! impl_transaction_for_tuple { #[doc = concat!("Transaction precondition error type for tuples of length ", $count, ".")] #[derive(Clone, Copy, Debug, Eq, PartialEq)] - #[allow(clippy::exhaustive_enums)] + #[expect(clippy::exhaustive_enums)] pub enum [< TupleError $count >]<$( [], )*> { $( #[doc = concat!("Error at tuple element ", $name, ".")] @@ -263,7 +263,7 @@ macro_rules! impl_transaction_for_tuple { } #[doc = concat!("Transaction conflict error type for tuples of length ", $count, ".")] #[derive(Clone, Copy, Debug, Eq, PartialEq)] - #[allow(clippy::exhaustive_enums)] + #[expect(clippy::exhaustive_enums)] pub enum [< TupleConflict $count >]<$( [], )*> { $( #[doc = concat!("Conflict at tuple element ", $name, ".")] diff --git a/all-is-cubes/src/transaction/tester.rs b/all-is-cubes/src/transaction/tester.rs index 6c7dc1c6f..b97491f7d 100644 --- a/all-is-cubes/src/transaction/tester.rs +++ b/all-is-cubes/src/transaction/tester.rs @@ -16,7 +16,6 @@ use super::Transaction; /// This test utility follows the builder pattern: call methods to add test data, then /// finish with [`Self::test`]. #[must_use] -#[allow(missing_debug_implementations)] pub struct TransactionTester<'a, Tr> where Tr: Transaction + Clone + Debug + 'a, @@ -31,7 +30,6 @@ where Tr: Transaction + Clone + Debug + 'a, Tr::Target: Debug + 'a, { - #[allow(clippy::new_without_default)] pub fn new() -> Self { Self { transactions: Vec::new(), @@ -131,7 +129,7 @@ pub type PredicateRes = Result<(), Box>; struct TransactionAndPredicate<'a, Tr: Transaction> { transaction: Tr, - #[allow( + #[expect( clippy::type_complexity, reason = "https://github.com/rust-lang/rust-clippy/issues/9299" )] diff --git a/all-is-cubes/src/universe.rs b/all-is-cubes/src/universe.rs index a33570d1c..9c557a6a4 100644 --- a/all-is-cubes/src/universe.rs +++ b/all-is-cubes/src/universe.rs @@ -60,7 +60,7 @@ mod tests; /// Internally uses [`Arc`] to be cheap to clone. Might be interned in future versions. /// #[doc = include_str!("save/serde-warning.md")] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] #[derive(Clone, Debug, Hash, Eq, Ord, PartialEq, PartialOrd)] pub enum Name { /// An explicitly set name. @@ -695,9 +695,10 @@ impl Universe { } #[allow(clippy::unused_self)] + #[mutants::skip] fn log_rerun_time(&self) { #[cfg(feature = "rerun")] - #[allow(clippy::cast_possible_wrap)] + #[expect(clippy::cast_possible_wrap)] self.rerun_destination .stream .set_time_sequence("session_step_time", self.session_step_time as i64); @@ -911,7 +912,7 @@ fn gc_members(table: &mut Storage) { /// `all_is_cubes_port::ExportSet` and doesn't play a role in the API itself. #[doc(hidden)] #[derive(Clone, Debug, Default, Eq, PartialEq)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct PartialUniverse { // TODO: design API that doesn't rely on making these public, but still allows // exports to be statically exhaustive. diff --git a/all-is-cubes/src/universe/handle.rs b/all-is-cubes/src/universe/handle.rs index c33c05927..b566b402e 100644 --- a/all-is-cubes/src/universe/handle.rs +++ b/all-is-cubes/src/universe/handle.rs @@ -747,7 +747,7 @@ mod private { /// Private type making it impossible to call [`ErasedHandle::connect_deserialized`] outside /// the crate. #[derive(Debug)] - #[allow(unnameable_types)] + #[expect(unnameable_types)] pub struct ErasedHandleInternalToken; } #[cfg(feature = "save")] @@ -887,7 +887,6 @@ mod tests { /// Handles are compared by pointer (each `Handle::new_pending()` is a new identity), /// not by name or member-value. #[test] - #[allow(clippy::eq_op)] fn handle_equality_is_pointer_equality() { let handle_a_1 = Handle::new_pending("space".into(), Space::empty_positive(1, 1, 1)); let handle_a_2 = handle_a_1.clone(); diff --git a/all-is-cubes/src/universe/members.rs b/all-is-cubes/src/universe/members.rs index d89990659..3571192ad 100644 --- a/all-is-cubes/src/universe/members.rs +++ b/all-is-cubes/src/universe/members.rs @@ -31,7 +31,7 @@ pub(crate) type Storage = BTreeMap>; /// that, it also cannot mention anything we don't also want to make public or /// public-in-private. #[doc(hidden)] -#[allow(unnameable_types)] +#[expect(unnameable_types)] pub trait UniverseMember: Sized + 'static + fmt::Debug { /// Generic constructor for [`AnyHandle`]. fn into_any_handle(r: Handle) -> AnyHandle; @@ -59,7 +59,7 @@ pub(crate) trait UniverseTable { /// This trait must be public(-in-private) so it can be a bound on public methods. /// It could be just public, but it's cleaner to not require importing it everywhere. #[doc(hidden)] -#[allow(unnameable_types)] +#[expect(unnameable_types)] pub trait UniverseOps where T: UniverseMember, @@ -77,7 +77,7 @@ where /// This trait must be public(-in-private) so it can be a bound on public methods. /// It could be just public, but it's cleaner to not require importing it everywhere. #[doc(hidden)] -#[allow(unnameable_types)] +#[expect(unnameable_types)] pub trait PartialUniverseOps where T: UniverseMember, @@ -242,7 +242,6 @@ macro_rules! member_enums_and_impls { /// Polymorphic container for [`TransactionInUniverse`] which is /// used to store transactions in a [`UniverseTransaction`]. #[derive(Clone, Default, PartialEq)] - #[allow(clippy::large_enum_variant)] #[non_exhaustive] pub(in crate::universe) enum AnyTransaction { #[default] @@ -333,7 +332,6 @@ macro_rules! member_enums_and_impls { /// [`AnyTransaction`] precondition errors. #[derive(Clone, Debug, Eq, PartialEq)] - #[allow(clippy::large_enum_variant)] #[non_exhaustive] pub(in crate::universe) enum AnyTransactionMismatch { $( @@ -348,7 +346,6 @@ macro_rules! member_enums_and_impls { /// [`AnyTransaction`] conflict errors. #[derive(Clone, Debug, Eq, PartialEq)] - #[allow(clippy::large_enum_variant)] #[non_exhaustive] pub(in crate::universe) enum AnyTransactionConflict { TypeMismatch, diff --git a/all-is-cubes/src/universe/owning_guard.rs b/all-is-cubes/src/universe/owning_guard.rs index a07b37a60..1cbfc7da2 100644 --- a/all-is-cubes/src/universe/owning_guard.rs +++ b/all-is-cubes/src/universe/owning_guard.rs @@ -45,7 +45,7 @@ pub(super) struct UBorrowImpl { /// [`Arc`] that keeps the data pointer alive as long as `guard` is in use. /// This field is never read, only dropped to decrement the reference count appropriately. - #[allow(dead_code, reason = "used for drop effect")] + #[expect(dead_code, reason = "used for drop effect")] strong: Strong, } @@ -58,7 +58,7 @@ pub(super) struct UBorrowMutImpl { /// [`Arc`] that keeps the data pointer alive as long as `guard` is in use. /// This field is never read, only dropped to decrement the reference count appropriately. - #[allow(dead_code, reason = "used for drop effect")] + #[expect(dead_code, reason = "used for drop effect")] strong: Strong, } diff --git a/all-is-cubes/src/universe/universe_txn.rs b/all-is-cubes/src/universe/universe_txn.rs index 4c75cccf2..1f8e0d9b3 100644 --- a/all-is-cubes/src/universe/universe_txn.rs +++ b/all-is-cubes/src/universe/universe_txn.rs @@ -431,7 +431,7 @@ impl UniverseTransaction { /// This transaction will fail if the member is already gone, is anonymous /// (only named entries can be deleted), or belongs to another universe. /// In the future, there may be a policy such that in-use items cannot be deleted. - #[allow(clippy::needless_pass_by_value)] // TODO: by ref or not by ref? + #[expect(clippy::needless_pass_by_value)] // TODO: by ref or not by ref? pub fn delete(member_handle: R) -> Self { Self::from_member_txn(member_handle.name(), MemberTxn::Delete) } diff --git a/all-is-cubes/src/util/maybe_sync.rs b/all-is-cubes/src/util/maybe_sync.rs index 8d6355930..114d7165f 100644 --- a/all-is-cubes/src/util/maybe_sync.rs +++ b/all-is-cubes/src/util/maybe_sync.rs @@ -101,7 +101,6 @@ impl RwLock { Self(InnerRwLock::new(value)) } - #[allow(dead_code)] // happens to be unused pub fn read(&self) -> Result, LockError>> { cfg_if::cfg_if! { if #[cfg(feature = "std")] { @@ -198,7 +197,6 @@ impl<'a, T> ops::DerefMut for RwLockWriteGuard<'a, T> { } pub(crate) enum LockError { - #[allow(dead_code)] Poisoned(G), } @@ -230,7 +228,6 @@ impl fmt::Debug for LockError { } pub(crate) enum TryLockError { - #[allow(dead_code)] Poisoned(G), WouldBlock, } diff --git a/all-is-cubes/src/util/status_text.rs b/all-is-cubes/src/util/status_text.rs index 6e4517af1..6d447e3f2 100644 --- a/all-is-cubes/src/util/status_text.rs +++ b/all-is-cubes/src/util/status_text.rs @@ -9,7 +9,7 @@ use all_is_cubes_base::util::ConciseDebug; /// /// This format does not follow Rust [`fmt::Debug`] syntax, and when implemented /// for standard Rust types may have quirks. Values may have multiple lines. -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub struct StatusText { /// Types of information to include or exclude. diff --git a/fuzz/fuzz_targets/fuzz_block_eval.rs b/fuzz/fuzz_targets/fuzz_block_eval.rs index d9a1b3b36..6082b2b4a 100644 --- a/fuzz/fuzz_targets/fuzz_block_eval.rs +++ b/fuzz/fuzz_targets/fuzz_block_eval.rs @@ -1,5 +1,4 @@ #![no_main] -#![allow(clippy::single_match)] use libfuzzer_sys::fuzz_target; diff --git a/test-renderers/src/harness.rs b/test-renderers/src/harness.rs index cbed18f93..5329654d3 100644 --- a/test-renderers/src/harness.rs +++ b/test-renderers/src/harness.rs @@ -29,7 +29,6 @@ type BoxedTestFn = Box BoxFuture<'static, ()> + Sen /// Wrapper for a `Future` which produces a `Universe` that may be used by multiple /// render tests (and should not be mutated). #[derive(Clone, Debug)] -#[allow(clippy::exhaustive_structs)] pub struct UniverseFuture { label: String, future: Shared>>, @@ -521,7 +520,7 @@ where } } -#[allow(missing_debug_implementations)] +#[expect(missing_debug_implementations)] pub struct TestCaseCollector<'a>(&'a mut BTreeMap); impl<'a> TestCaseCollector<'a> { diff --git a/test-renderers/src/image_files.rs b/test-renderers/src/image_files.rs index 569681ea2..3702126e3 100644 --- a/test-renderers/src/image_files.rs +++ b/test-renderers/src/image_files.rs @@ -12,7 +12,7 @@ use crate::{SuiteId, TestId}; /// between different expected/actual pairs. // TODO: better name #[derive(Clone, Eq, Hash, PartialEq, serde::Serialize, serde::Deserialize)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct ImageId { pub test_id: TestId, pub renderer: RendererId, @@ -33,7 +33,7 @@ impl fmt::Debug for ImageId { } #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, serde::Serialize, serde::Deserialize)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum RendererId { /// A single expected output expected to be equal for all renderers. /// No renderer uses this value. @@ -76,7 +76,7 @@ impl fmt::Display for RendererId { } } -#[allow(rustdoc::private_intra_doc_links)] +#[expect(rustdoc::private_intra_doc_links)] /// Selector of which image role is wanted from [`image_path`] and [`test_data_dir_path`]. #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] #[non_exhaustive] diff --git a/test-renderers/src/lib.rs b/test-renderers/src/lib.rs index a1b9698f9..91004d9bd 100644 --- a/test-renderers/src/lib.rs +++ b/test-renderers/src/lib.rs @@ -40,7 +40,7 @@ pub mod test_cases; #[derive( Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, )] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum SuiteId { Renderers, Ui, @@ -71,7 +71,7 @@ impl fmt::Display for SuiteId { #[derive( Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, )] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct TestId { pub suite: SuiteId, @@ -119,7 +119,7 @@ pub struct ComparisonRecord { } #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[allow(clippy::exhaustive_enums)] +#[expect(clippy::exhaustive_enums)] pub enum ComparisonOutcome { /// Images had no differences above the threshold. Equal, @@ -149,7 +149,6 @@ impl ComparisonOutcome { } impl ComparisonRecord { - #[allow(clippy::large_types_passed_by_value)] fn from_paths( expected_file_path: &Path, actual_file_path: &Path, @@ -194,7 +193,7 @@ impl ComparisonRecord { } /// Finish a rendering test by storing/displaying/comparing the output image. -#[allow(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value)] pub fn compare_rendered_image( test: ImageId, allowed_difference: &Threshold, diff --git a/test-renderers/src/render.rs b/test-renderers/src/render.rs index 2c025da00..9746af625 100644 --- a/test-renderers/src/render.rs +++ b/test-renderers/src/render.rs @@ -37,7 +37,7 @@ impl Scene for &Universe { /// Dynamic overlay content passed to the [`HeadlessRenderer`] per-frame. /// This is a combination of the parameters of `update()` and `draw()`. #[derive(Clone, Debug, PartialEq)] -#[allow( +#[expect( clippy::exhaustive_structs, reason = "will very likely go through incompatible changes anyway" )] @@ -72,7 +72,7 @@ pub trait RendererFactory: Send + Sync + Debug { /// [`RendererFactory`] implementor which produces [`all_is_cubes_render::raytracer::RtRenderer`]s. #[derive(Clone, Debug)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct RtFactory; impl RendererFactory for RtFactory { diff --git a/test-renderers/src/report.rs b/test-renderers/src/report.rs index 2536c41d2..3e1a694b5 100644 --- a/test-renderers/src/report.rs +++ b/test-renderers/src/report.rs @@ -10,7 +10,7 @@ use crate::{test_data_dir_path, ComparisonRecord, RendererId, SuiteId, TestId, V /// Record of what happened when a specific test case was run with a specific renderer. #[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[allow(clippy::exhaustive_structs)] +#[expect(clippy::exhaustive_structs)] pub struct TestCaseOutput { pub test_id: TestId, pub outcome: Result<(), String>, diff --git a/test-renderers/src/test_cases.rs b/test-renderers/src/test_cases.rs index b607495f1..87a623ddd 100644 --- a/test-renderers/src/test_cases.rs +++ b/test-renderers/src/test_cases.rs @@ -1,7 +1,7 @@ //! Graphical test cases that can be run in any renderer. -#![allow(clippy::unused_async)] -#![allow(clippy::cast_possible_wrap)] +#![expect(clippy::unused_async)] +#![expect(clippy::cast_possible_wrap)] use std::future::Future; use std::str::FromStr; @@ -126,7 +126,6 @@ pub fn all_tests(c: &mut TestCaseCollector<'_>) { c.insert("viewport_prime", None, viewport_prime); } -#[allow(clippy::unnecessary_wraps, reason = "convenience where it is used")] pub fn u( label: &str, f: impl Future> + Send + 'static,