Add clippy solutions

This commit is contained in:
David Bailey 2021-01-17 11:42:58 +00:00
parent 3bdae9bb8a
commit e50c35eb7c
2 changed files with 2 additions and 6 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() > f64::EPSILON {
println!("Success!");
}
}

View file

@ -1,12 +1,10 @@
// 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 {
if let Some(x) = option {
res += x;
}
println!("{}", res);