Skip to content

Commit

Permalink
Deps: Update euclid to 0.22.11 and take advantage.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Sep 21, 2024
1 parent ce84ff9 commit cfe2e93
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 53 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 2 additions & 2 deletions all-is-cubes-wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 1 addition & 24 deletions all-is-cubes/src/block/modifier/zoom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<Self> {
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<usize>) {
use arbitrary::{size_hint::and_all, Arbitrary};
and_all(&[
<Resolution as Arbitrary>::size_hint(depth),
<[GridCoordinate; 3] as Arbitrary>::size_hint(depth),
])
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
1 change: 0 additions & 1 deletion all-is-cubes/src/block/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
24 changes: 1 addition & 23 deletions all-is-cubes/src/space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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².
Expand Down Expand Up @@ -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<Self> {
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<usize>) {
use arbitrary::{size_hint::and_all, Arbitrary};
and_all(&[
<f64 as Arbitrary>::size_hint(depth),
<f64 as Arbitrary>::size_hint(depth),
<Sky as Arbitrary>::size_hint(depth),
<LightPhysics as Arbitrary>::size_hint(depth),
])
}
}

/// Method used to compute the illumination of individual blocks in a [`Space`].
#[non_exhaustive]
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
Expand Down

0 comments on commit cfe2e93

Please sign in to comment.