rust/land2d/src/lib.rs
changeset 14170 8e2e98760003
parent 14169 d3c9025abd13
child 14171 6205a5230d23
--- a/rust/land2d/src/lib.rs	Tue Nov 06 23:29:12 2018 +0300
+++ b/rust/land2d/src/lib.rs	Tue Nov 06 23:45:54 2018 +0300
@@ -151,14 +151,12 @@
 
         while let Some((mut xl, mut xr, y, dir)) = stack.pop() {
             let row = &mut self.pixels[y][..];
-            while xl > 0 && row.get(xl)
-                .map_or(false, |v| *v != border_value && *v != fill_value)
+            while xl > 0 && row[xl] != border_value && row[xl] != fill_value
             {
                 xl -= 1;
             }
 
-            while xr < width - 1 && row.get(xr)
-                .map_or(false, |v| *v != border_value && *v != fill_value)
+            while xr < width - 1 && row[xr] != border_value && row[xr] != fill_value
             {
                 xr += 1;
             }
@@ -171,7 +169,7 @@
 
                 let x = xl;
 
-                while xl <= xr && (row[xl] != border_value && row[xl] != fill_value)
+                while xl <= xr && row[xl] != border_value && row[xl] != fill_value
                 {
                     row[xl] = fill_value;
                     xl += 1;