]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/option_if_let_else.fixed
New upstream version 1.54.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / option_if_let_else.fixed
index 47e7460fa7a44d4a11f38119d9c2a118d7075d0f..769ccc14bc1e4c2ba27f1e0a21c46799f052a3cc 100644 (file)
@@ -10,7 +10,11 @@ fn bad1(string: Option<&str>) -> (bool, &str) {
 fn else_if_option(string: Option<&str>) -> Option<(bool, &str)> {
     if string.is_none() {
         None
-    } else { string.map_or(Some((false, "")), |x| Some((true, x))) }
+    } else if let Some(x) = string {
+        Some((true, x))
+    } else {
+        Some((false, ""))
+    }
 }
 
 fn unop_bad(string: &Option<&str>, mut num: Option<i32>) {