2 #![warn(clippy::match_result_ok)]
4 #![allow(clippy::boxed_local, clippy::uninlined_format_args)]
8 fn str_to_int(x: &str) -> i32 {
9 if let Some(y) = x.parse().ok() { y } else { 0 }
12 fn str_to_int_ok(x: &str) -> i32 {
13 if let Ok(y) = x.parse() { y } else { 0 }
17 fn strange_some_no_else(x: &str) -> i32 {
19 if let Some(y) = x . parse() . ok () {
26 // Checking `while` cases
33 fn next(&mut self) -> Result<i32, &str> {
44 let mut wat = Wat { counter: x };
45 while let Some(a) = wat.next().ok() {
51 let mut wat = Wat { counter: x };
52 while let Ok(a) = wat.next() {
57 fn base_3(test_func: Box<Result<i32, &str>>) {
58 // Expected to stay as is
59 while let Some(_b) = test_func.ok() {}