From 342e299d8a8fd79f07960312b73e241c6cc0400e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 9 Jul 2015 22:56:33 +0200 Subject: [PATCH 1/1] be more explicit about dereferencing --- src/part10.rs | 2 +- workspace/src/part10.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/part10.rs b/src/part10.rs index c8a0129..452e993 100644 --- a/src/part10.rs +++ b/src/part10.rs @@ -115,7 +115,7 @@ fn inc_print_even(v: &Vec, offset: i32, threshold: i32) { //@ //@ Since all these closures compile down to the pattern described above, there is actually no heap allocation going on here. This makes //@ closures very efficient, and it makes optimization fairly trivial: The resulting code will look like you hand-rolled the loop in C. - for i in v.iter().map(|n| n + offset).filter(|n| *n > threshold) { + for i in v.iter().map(|n| *n + offset).filter(|n| *n > threshold) { println!("{}", i); } } diff --git a/workspace/src/part10.rs b/workspace/src/part10.rs index f7d9028..7af1617 100644 --- a/workspace/src/part10.rs +++ b/workspace/src/part10.rs @@ -76,7 +76,7 @@ pub fn print_and_count(b: &BigInt) { // Let's say we want to write a function that increments every entry of a `Vec` by some number, then looks for numbers larger than some threshold, and prints them. fn inc_print_even(v: &Vec, offset: i32, threshold: i32) { - for i in v.iter().map(|n| n + offset).filter(|n| *n > threshold) { + for i in v.iter().map(|n| *n + offset).filter(|n| *n > threshold) { println!("{}", i); } } -- 2.30.2