diff --git a/Cargo.lock b/Cargo.lock index cb5de28b1..9a4a14386 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2015,9 +2015,9 @@ checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" [[package]] name = "euclid" -version = "0.22.10" +version = "0.22.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f0eb73b934648cd7a4a61f1b15391cd95dab0b4da6e2e66c2a072c144b4a20" +checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48" dependencies = [ "arbitrary", "mint", diff --git a/Cargo.toml b/Cargo.toml index d1dcf6da0..5a05a0811 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ either = { version = "1.10.0", default-features = false } # embedded-graphics and embedded-graphics-core must match embedded-graphics = "0.8.0" embedded-graphics-core = "0.4.0" -euclid = { version = "0.22.10", default-features = false } +euclid = { version = "0.22.11", default-features = false } exhaust = { version = "0.2.0", default-features = false } flume = { version = "0.11.0", default-features = false, features = ["async"] } futures-channel = { version = "0.3.28", default-features = false, features = ["alloc"] } diff --git a/all-is-cubes-wasm/Cargo.lock b/all-is-cubes-wasm/Cargo.lock index fa65f5fd2..4e0711ed7 100644 --- a/all-is-cubes-wasm/Cargo.lock +++ b/all-is-cubes-wasm/Cargo.lock @@ -579,9 +579,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "euclid" -version = "0.22.10" +version = "0.22.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f0eb73b934648cd7a4a61f1b15391cd95dab0b4da6e2e66c2a072c144b4a20" +checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48" dependencies = [ "mint", "num-traits", diff --git a/all-is-cubes/src/block/modifier/zoom.rs b/all-is-cubes/src/block/modifier/zoom.rs index 849994894..32ae7b617 100644 --- a/all-is-cubes/src/block/modifier/zoom.rs +++ b/all-is-cubes/src/block/modifier/zoom.rs @@ -13,6 +13,7 @@ use crate::universe; /// Design note: This is a struct separate from [`Modifier`] so that it can have a /// constructor accepting only valid bounds. #[derive(Clone, Debug, Eq, Hash, PartialEq)] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] pub struct Zoom { /// Scale factor to zoom in by. scale: Resolution, @@ -154,30 +155,6 @@ impl universe::VisitHandles for Zoom { } } -#[cfg(feature = "arbitrary")] -impl<'a> arbitrary::Arbitrary<'a> for Zoom { - fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { - let scale = u.arbitrary()?; - let max_offset = GridCoordinate::from(scale) - 1; - Ok(Self::new( - scale, - GridPoint::new( - u.int_in_range(0..=max_offset)?, - u.int_in_range(0..=max_offset)?, - u.int_in_range(0..=max_offset)?, - ), - )) - } - - fn size_hint(depth: usize) -> (usize, Option) { - use arbitrary::{size_hint::and_all, Arbitrary}; - and_all(&[ - ::size_hint(depth), - <[GridCoordinate; 3] as Arbitrary>::size_hint(depth), - ]) - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/all-is-cubes/src/block/text.rs b/all-is-cubes/src/block/text.rs index 079c3c1e2..0c2abb831 100644 --- a/all-is-cubes/src/block/text.rs +++ b/all-is-cubes/src/block/text.rs @@ -394,7 +394,6 @@ impl<'a> arbitrary::Arbitrary<'a> for Text { // text rendering because that'll be easier. // (Another possibility would be to actually restrict `layout_bounds` itself,) let layout_bounds = GridAab::checked_from_lower_upper( - // euclid::Point3D doesn't implement Arbitrary (just an oversight apparently) <[i16; 3]>::arbitrary(u)?.map(i32::from), <[u16; 3]>::arbitrary(u)?.map(i32::from), ) diff --git a/all-is-cubes/src/space.rs b/all-is-cubes/src/space.rs index 61f6b3cd0..1299386aa 100644 --- a/all-is-cubes/src/space.rs +++ b/all-is-cubes/src/space.rs @@ -1051,6 +1051,7 @@ impl SpaceBehaviorAttachment { /// and so an instance of it can be reused for similar spaces (e.g. /// [`DEFAULT_FOR_BLOCK`](Self::DEFAULT_FOR_BLOCK)). #[derive(Clone, Eq, Hash, PartialEq)] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[non_exhaustive] pub struct SpacePhysics { /// Gravity vector for moving objects, in cubes/s². @@ -1106,29 +1107,6 @@ impl Default for SpacePhysics { } } -#[cfg(feature = "arbitrary")] -#[mutants::skip] -impl<'a> arbitrary::Arbitrary<'a> for SpacePhysics { - fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { - Ok(Self { - // Vector3D doesn't implement Arbitrary - gravity: vec3(u.arbitrary()?, u.arbitrary()?, u.arbitrary()?), - sky: u.arbitrary()?, - light: u.arbitrary()?, - }) - } - - fn size_hint(depth: usize) -> (usize, Option) { - use arbitrary::{size_hint::and_all, Arbitrary}; - and_all(&[ - ::size_hint(depth), - ::size_hint(depth), - ::size_hint(depth), - ::size_hint(depth), - ]) - } -} - /// Method used to compute the illumination of individual blocks in a [`Space`]. #[non_exhaustive] #[derive(Clone, Debug, Eq, Hash, PartialEq)]