From c84c38544bc6e81f0b0482e4e82b6c95848c1a0c Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 6 Apr 2021 14:54:54 +0530 Subject: apply clippy lints --- src/bitmap.rs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/bitmap.rs') diff --git a/src/bitmap.rs b/src/bitmap.rs index 8010a4b..2f96a99 100644 --- a/src/bitmap.rs +++ b/src/bitmap.rs @@ -29,7 +29,7 @@ impl TryFrom<(i32, i32)> for MapPoint { type Error = (); fn try_from((x, y): (i32, i32)) -> Result { if x < 0 || y < 0 { - return Err(()); + Err(()) } else { Ok(MapPoint { x: x as u32, @@ -43,7 +43,7 @@ impl TryFrom<(i64, i64)> for MapPoint { type Error = (); fn try_from((x, y): (i64, i64)) -> Result { if x < 0 || y < 0 { - return Err(()); + Err(()) } else { Ok(MapPoint { x: x as u32, @@ -79,18 +79,6 @@ pub enum Axis { Y, } -impl Into for Axis { - fn into(self) -> LispExpr { - LispExpr::Quote( - Box::new(LispExpr::Ident(match self { - Self::X => "X".into(), - Self::Y => "Y".into(), - })), - 1, - ) - } -} - impl TryFrom<&LispExpr> for Axis { type Error = EvalError; fn try_from(value: &LispExpr) -> Result { @@ -224,7 +212,7 @@ where circle.extend((x - dy.abs() + 1..x + dy.abs()).map(|x| (x, y + dx))); circle.extend((x - dy.abs() + 1..x + dy.abs()).map(|x| (x, y - dx))); } - dy = dy + 1; + dy += 1; if err < 0 { err = err + 2 * dy + 1; } else { @@ -234,7 +222,7 @@ where } circle .into_iter() - .flat_map(|pt| MapPoint::try_from(pt)) + .flat_map(MapPoint::try_from) .filter(|&pt| self.contains(pt)) .collect() } @@ -279,7 +267,7 @@ where } coordinates .into_iter() - .flat_map(|pt| MapPoint::try_from(pt)) + .flat_map(MapPoint::try_from) .filter(|&pt| self.contains(pt)) .collect() } -- cgit v1.2.3