From a0e810b4713bcef60f64f4709ee27c3acec676cd Mon Sep 17 00:00:00 2001 From: mo8it Date: Mon, 1 Jul 2024 11:55:18 +0200 Subject: clippy2 solution --- solutions/22_clippy/clippy2.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'solutions/22_clippy/clippy2.rs') diff --git a/solutions/22_clippy/clippy2.rs b/solutions/22_clippy/clippy2.rs index 4e18198..7f63562 100644 --- a/solutions/22_clippy/clippy2.rs +++ b/solutions/22_clippy/clippy2.rs @@ -1 +1,10 @@ -// Solutions will be available before the stable release. Thank you for testing the beta version 🥰 +fn main() { + let mut res = 42; + let option = Some(12); + // Use `if-let` instead of iteration. + if let Some(x) = option { + res += x; + } + + println!("{res}"); +} -- cgit v1.2.3