# HG changeset patch
# User unc0rr
# Date 1539545175 -7200
# Node ID f64790b2a725b9dfa79e9f5ccbb49f497a5341f8
# Parent  ef50e4f59b8fedb8f1504c7650a1b2d50f6c7945
Simplify Vec2D::new() a bit

diff -r ef50e4f59b8f -r f64790b2a725 rust/vec2d/src/lib.rs
--- a/rust/vec2d/src/lib.rs	Sun Oct 14 23:25:20 2018 +0300
+++ b/rust/vec2d/src/lib.rs	Sun Oct 14 21:26:15 2018 +0200
@@ -33,15 +33,11 @@
 
 impl<T: Copy> Vec2D<T> {
     pub fn new(width: usize, height: usize, value: T) -> Self {
-        let mut vec = Self {
-            data: Vec::new(),
+        Self {
+            data: vec![value; width * height],
             width,
             height,
-        };
-
-        vec.data.extend(iter::repeat(value).take(width * height));
-
-        vec
+        }
     }
 
     #[inline]