From bfed87a40e4852ec488cf364c0e232f01cfc3fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Sun, 7 Aug 2022 11:52:57 +0200 Subject: [PATCH] ch2_mandelbrot: Fix initialization of Vec() --- ch2/ch2-mandelbrot/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ch2/ch2-mandelbrot/src/main.rs b/ch2/ch2-mandelbrot/src/main.rs index a887cef0..5af363ee 100644 --- a/ch2/ch2-mandelbrot/src/main.rs +++ b/ch2/ch2-mandelbrot/src/main.rs @@ -11,10 +11,10 @@ fn calculate_mandelbrot( // <2> height: usize, // <5> ) -> Vec> { - let mut rows: Vec<_> = Vec::with_capacity(width); // <6> + let mut rows: Vec<_> = Vec::with_capacity(height); // <6> for img_y in 0..height { // <7> - let mut row: Vec = Vec::with_capacity(height); + let mut row: Vec = Vec::with_capacity(width); for img_x in 0..width { let x_percent = (img_x as f64 / width as f64); @@ -70,7 +70,7 @@ fn render_mandelbrot(escape_vals: Vec>) { } fn main() { - + let mandelbrot = calculate_mandelbrot(1000, -2.0, 1.0, -1.0, 1.0, 100, 24);