]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/if_let_some_result.fixed
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / if_let_some_result.fixed
1 // run-rustfix
2
3 #![warn(clippy::if_let_some_result)]
4 #![allow(dead_code)]
5
6 fn str_to_int(x: &str) -> i32 {
7 if let Ok(y) = x.parse() { y } else { 0 }
8 }
9
10 fn str_to_int_ok(x: &str) -> i32 {
11 if let Ok(y) = x.parse() { y } else { 0 }
12 }
13
14 #[rustfmt::skip]
15 fn strange_some_no_else(x: &str) -> i32 {
16 {
17 if let Ok(y) = x . parse() {
18 return y;
19 };
20 0
21 }
22 }
23
24 fn negative() {
25 while let Some(1) = "".parse().ok() {}
26 }
27
28 fn main() {}