+// run-rustfix
+
#![warn(clippy::or_fun_call)]
+#![allow(dead_code)]
use std::collections::BTreeMap;
use std::collections::HashMap;
let with_vec = Some(vec![1]);
with_vec.unwrap_or(vec![]);
- // FIXME #944: ~|SUGGESTION with_vec.unwrap_or_else(|| vec![]);
-
let without_default = Some(Foo);
without_default.unwrap_or(Foo::new());
.or(Some(Bar(b, Duration::from_secs(2))));
}
+// Issue 4514 - early return
+fn f() -> Option<()> {
+ let a = Some(1);
+ let b = 1i32;
+
+ let _ = a.unwrap_or(b.checked_mul(3)?.min(240));
+
+ Some(())
+}
+
fn main() {}