mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-03 01:09:18 +00:00
update
This commit is contained in:
parent
61189f0851
commit
398aacb513
@ -6,12 +6,10 @@
|
|||||||
// check clippy's suggestions from the output to solve the exercise.
|
// check clippy's suggestions from the output to solve the exercise.
|
||||||
// Execute `rustlings hint clippy1` for hints :)
|
// Execute `rustlings hint clippy1` for hints :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 1.2331f64;
|
let x = 1.2331f64;
|
||||||
let y = 1.2332f64;
|
let y = 1.2332f64;
|
||||||
if y != x {
|
if (y - x).abs() > 0.0001 {
|
||||||
println!("Success!");
|
println!("Success!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
// clippy2.rs
|
// clippy2.rs
|
||||||
// Make me compile! Execute `rustlings hint clippy2` for hints :)
|
// Make me compile! Execute `rustlings hint clippy2` for hints :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut res = 42;
|
let mut res = 42;
|
||||||
let option = Some(12);
|
let option = Some(12);
|
||||||
for x in option {
|
// for x in option.into_iter() {
|
||||||
res += x;
|
if let Some(x) = option {
|
||||||
|
res += x;
|
||||||
}
|
}
|
||||||
println!("{}", res);
|
println!("{}", res);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user