rustlings/solutions/22_clippy/clippy2.rs

11 lines
183 B
Rust
Raw Permalink Normal View History

2024-10-28 20:46:17 +00:00
fn main() {
2024-11-09 11:43:57 +00:00
let mut res = 42;
let option = Some(12);
// Use `if-let` instead of iteration.
if let Some(x) = option {
res += x;
}
println!("{res}");
2024-10-28 20:46:17 +00:00
}