--- a/rust/land2d/src/lib.rs Thu Oct 18 23:59:23 2018 +0300
+++ b/rust/land2d/src/lib.rs Fri Oct 19 00:49:09 2018 +0300
@@ -1,7 +1,8 @@
extern crate integral_geometry;
extern crate vec2d;
-use std::{cmp, mem::replace};
+use std::cmp;
+use std::ops;
use integral_geometry::{ArcPoints, EquidistantPoints, LinePoints, Point};
@@ -213,8 +214,12 @@
for point in LinePoints::new(from, to) {
for vector in ArcPoints::new(radius) {
for delta in EquidistantPoints::new(vector) {
- self.map_point(point + delta, |p|
- result += (replace(p, value) != value) as usize)
+ self.map_point(point + delta, |p| {
+ if *p != value {
+ *p = value;
+ result += 1;
+ }
+ })
}
}
}