From 111baaab81aa0a10fe68778fabb40bd025cb1a7d Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Wed, 8 Mar 2023 14:37:45 -0600 Subject: [PATCH] clippy --fix --- src/aztec/DetectorTest.rs | 6 +++--- src/common/default_grid_sampler.rs | 5 ++--- src/common/quad.rs | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/aztec/DetectorTest.rs b/src/aztec/DetectorTest.rs index c3074cc..5a21d0d 100644 --- a/src/aztec/DetectorTest.rs +++ b/src/aztec/DetectorTest.rs @@ -124,9 +124,9 @@ fn test_error_in_parameter_locator(data: &str) { let r = r.expect("result already tested as ok"); assert_eq!(r.getNbLayers(), layers); assert_eq!(r.isCompact(), compact); - let res = decoder::decode(&r).expect(&format!( - "decode should be ok: {isMirror}, {error1}, {error2}" - )); + let res = decoder::decode(&r).unwrap_or_else(|_| { + panic!("decode should be ok: {isMirror}, {error1}, {error2}") + }); assert_eq!(data, res.getText()); } } diff --git a/src/common/default_grid_sampler.rs b/src/common/default_grid_sampler.rs index 96ec72a..556642f 100644 --- a/src/common/default_grid_sampler.rs +++ b/src/common/default_grid_sampler.rs @@ -45,9 +45,8 @@ impl GridSampler for DefaultGridSampler { // To deal with remaining examples (see #251 and #267) of "numercial instabilities" that have not been // prevented with the Quadrilateral.h:IsConvex() check, we check for all boundary points of the grid to // be inside. - let isInside = |p: Point| -> bool { - return image.is_in(transform.transform_point(p.centered())); - }; + let isInside = + |p: Point| -> bool { image.is_in(transform.transform_point(p.centered())) }; for y in (p0.y as i32)..(p1.y as i32) { // for (int y = y0; y < y1; ++y) if !isInside(point(p0.x, y as f32)) || !isInside(point(p1.x - 1.0, y as f32)) { diff --git a/src/common/quad.rs b/src/common/quad.rs index 9873d8b..688a1dd 100644 --- a/src/common/quad.rs +++ b/src/common/quad.rs @@ -171,7 +171,7 @@ impl Quadrilateral { let mirror = if let Some(m) = mirror { m } else { false }; - let mut res = self.clone(); + let mut res = *self; res.0.rotate_left(((n + 4) % 4) as usize); // std::rotate_copy(q.begin(), q.begin() + ((n + 4) % 4), q.end(), res.begin()); if mirror {