]> git.lizzy.rs Git - rust.git/blob - tests/ui/if_let_some_result.fixed
Rename `ok_if_let` to `if_let_some_result`
[rust.git] / tests / ui / if_let_some_result.fixed
1 // run-rustfix
2
3 #![warn(clippy::if_let_some_result)]
4
5 fn str_to_int(x: &str) -> i32 {
6     if let Ok(y) = x.parse() {
7         y
8     } else {
9         0
10     }
11 }
12
13 fn str_to_int_ok(x: &str) -> i32 {
14     if let Ok(y) = x.parse() {
15         y
16     } else {
17         0
18     }
19 }
20
21 fn nested_some_no_else(x: &str) -> i32 {
22     {
23         if let Ok(y) = x.parse() {
24             return y;
25         };
26         0
27     }
28 }
29
30 fn main() {
31     let _ = str_to_int("1");
32     let _ = str_to_int_ok("2");
33     let _ = nested_some_no_else("3");
34 }