2025-02-04 19:23:03 -07:00
|
|
|
//@no-rustfix
|
|
|
|
|
fn issue_12670() {
|
|
|
|
|
// no auto: type not found
|
|
|
|
|
#[allow(clippy::match_result_ok)]
|
|
|
|
|
let _ = if let Some(x) = "1".parse().ok() {
|
2025-02-12 23:44:38 +01:00
|
|
|
//~^ manual_unwrap_or_default
|
2025-02-04 19:23:03 -07:00
|
|
|
x
|
|
|
|
|
} else {
|
|
|
|
|
i32::default()
|
|
|
|
|
};
|
|
|
|
|
let _ = if let Some(x) = None { x } else { i32::default() };
|
2025-02-11 17:57:08 +01:00
|
|
|
//~^ manual_unwrap_or_default
|
2025-02-04 19:23:03 -07:00
|
|
|
// auto fix with unwrap_or_default
|
|
|
|
|
let a: Option<i32> = None;
|
|
|
|
|
let _ = if let Some(x) = a { x } else { i32::default() };
|
2025-02-11 17:57:08 +01:00
|
|
|
//~^ manual_unwrap_or_default
|
2025-02-04 19:23:03 -07:00
|
|
|
let _ = if let Some(x) = Some(99) { x } else { i32::default() };
|
2025-02-11 17:57:08 +01:00
|
|
|
//~^ manual_unwrap_or_default
|
2025-02-04 19:23:03 -07:00
|
|
|
}
|