From 398aacb513e228e96129c127052ea0c9b1b11334 Mon Sep 17 00:00:00 2001 From: tab <dearhange@126.com> Date: Thu, 7 May 2020 21:33:52 +0800 Subject: [PATCH] update --- exercises/clippy/clippy1.rs | 4 +--- exercises/clippy/clippy2.rs | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/exercises/clippy/clippy1.rs b/exercises/clippy/clippy1.rs index bdb5dd2..ea9c4ea 100644 --- a/exercises/clippy/clippy1.rs +++ b/exercises/clippy/clippy1.rs @@ -6,12 +6,10 @@ // check clippy's suggestions from the output to solve the exercise. // Execute `rustlings hint clippy1` for hints :) -// I AM NOT DONE - fn main() { let x = 1.2331f64; let y = 1.2332f64; - if y != x { + if (y - x).abs() > 0.0001 { println!("Success!"); } } diff --git a/exercises/clippy/clippy2.rs b/exercises/clippy/clippy2.rs index 37af9ed..d698104 100644 --- a/exercises/clippy/clippy2.rs +++ b/exercises/clippy/clippy2.rs @@ -1,13 +1,12 @@ // clippy2.rs // Make me compile! Execute `rustlings hint clippy2` for hints :) -// I AM NOT DONE - fn main() { let mut res = 42; let option = Some(12); - for x in option { - res += x; + // for x in option.into_iter() { + if let Some(x) = option { + res += x; } println!("{}", res); }