aboutsummaryrefslogtreecommitdiff
path: root/src/bitmap.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-04-06 10:24:54 +0100
committerAkshay <[email protected]>2021-04-06 10:24:54 +0100
commitc84c38544bc6e81f0b0482e4e82b6c95848c1a0c (patch)
tree3ae2f3387ba5ef56a7f7c3304dc029ae7845f175 /src/bitmap.rs
parent3f5b917c6ced370d940774b51ff89cec0d03c562 (diff)
apply clippy lints
Diffstat (limited to 'src/bitmap.rs')
-rw-r--r--src/bitmap.rs22
1 files changed, 5 insertions, 17 deletions
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 {
29 type Error = (); 29 type Error = ();
30 fn try_from((x, y): (i32, i32)) -> Result<Self, Self::Error> { 30 fn try_from((x, y): (i32, i32)) -> Result<Self, Self::Error> {
31 if x < 0 || y < 0 { 31 if x < 0 || y < 0 {
32 return Err(()); 32 Err(())
33 } else { 33 } else {
34 Ok(MapPoint { 34 Ok(MapPoint {
35 x: x as u32, 35 x: x as u32,
@@ -43,7 +43,7 @@ impl TryFrom<(i64, i64)> for MapPoint {
43 type Error = (); 43 type Error = ();
44 fn try_from((x, y): (i64, i64)) -> Result<Self, Self::Error> { 44 fn try_from((x, y): (i64, i64)) -> Result<Self, Self::Error> {
45 if x < 0 || y < 0 { 45 if x < 0 || y < 0 {
46 return Err(()); 46 Err(())
47 } else { 47 } else {
48 Ok(MapPoint { 48 Ok(MapPoint {
49 x: x as u32, 49 x: x as u32,
@@ -79,18 +79,6 @@ pub enum Axis {
79 Y, 79 Y,
80} 80}
81 81
82impl Into<LispExpr> for Axis {
83 fn into(self) -> LispExpr {
84 LispExpr::Quote(
85 Box::new(LispExpr::Ident(match self {
86 Self::X => "X".into(),
87 Self::Y => "Y".into(),
88 })),
89 1,
90 )
91 }
92}
93
94impl TryFrom<&LispExpr> for Axis { 82impl TryFrom<&LispExpr> for Axis {
95 type Error = EvalError; 83 type Error = EvalError;
96 fn try_from(value: &LispExpr) -> Result<Self, Self::Error> { 84 fn try_from(value: &LispExpr) -> Result<Self, Self::Error> {
@@ -224,7 +212,7 @@ where
224 circle.extend((x - dy.abs() + 1..x + dy.abs()).map(|x| (x, y + dx))); 212 circle.extend((x - dy.abs() + 1..x + dy.abs()).map(|x| (x, y + dx)));
225 circle.extend((x - dy.abs() + 1..x + dy.abs()).map(|x| (x, y - dx))); 213 circle.extend((x - dy.abs() + 1..x + dy.abs()).map(|x| (x, y - dx)));
226 } 214 }
227 dy = dy + 1; 215 dy += 1;
228 if err < 0 { 216 if err < 0 {
229 err = err + 2 * dy + 1; 217 err = err + 2 * dy + 1;
230 } else { 218 } else {
@@ -234,7 +222,7 @@ where
234 } 222 }
235 circle 223 circle
236 .into_iter() 224 .into_iter()
237 .flat_map(|pt| MapPoint::try_from(pt)) 225 .flat_map(MapPoint::try_from)
238 .filter(|&pt| self.contains(pt)) 226 .filter(|&pt| self.contains(pt))
239 .collect() 227 .collect()
240 } 228 }
@@ -279,7 +267,7 @@ where
279 } 267 }
280 coordinates 268 coordinates
281 .into_iter() 269 .into_iter()
282 .flat_map(|pt| MapPoint::try_from(pt)) 270 .flat_map(MapPoint::try_from)
283 .filter(|&pt| self.contains(pt)) 271 .filter(|&pt| self.contains(pt))
284 .collect() 272 .collect()
285 } 273 }