Fix or_fun_call bad suggestion

Closes #4514
This commit is contained in:
Michael Wright 2019-09-08 11:03:45 +02:00
parent f30bf69ec7
commit 9bdfd0683f
3 changed files with 54 additions and 25 deletions

View file

@ -99,4 +99,16 @@ fn test_or_with_ctors() {
.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() {}

View file

@ -99,4 +99,16 @@ fn test_or_with_ctors() {
.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() {}