revert 2354264ab0b0
authoralfadur
Fri, 19 Oct 2018 00:49:09 +0300
changeset 13967 54e2a3698425
parent 13966 2354264ab0b0
child 13968 85645992bc8a
revert 2354264ab0b0
rust/land2d/src/lib.rs
--- 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;
+                        }
+                    })
                 }
             }
         }