This commit is contained in:
tab 2020-05-07 21:33:52 +08:00
parent 61189f0851
commit 398aacb513
2 changed files with 4 additions and 7 deletions
exercises/clippy

View file

@ -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!");
}
}

View file

@ -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);
}