complete: clippy
This commit is contained in:
parent
e67dafa971
commit
4a08fff2b8
exercises/clippy
|
@ -6,12 +6,11 @@
|
|||
// check clippy's suggestions from the output to solve the exercise.
|
||||
// Execute `rustlings hint clippy1` for hints :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let error_margin = f64::EPSILON;
|
||||
let x = 1.2331f64;
|
||||
let y = 1.2332f64;
|
||||
if y != x {
|
||||
if (y - x).abs() > error_margin {
|
||||
println!("Success!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue