Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

or_fun_call suggests invalid code #4514

Closed
YaLTeR opened this issue Sep 6, 2019 · 0 comments · Fixed by #4522
Closed

or_fun_call suggests invalid code #4514

YaLTeR opened this issue Sep 6, 2019 · 0 comments · Fixed by #4522
Labels
C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied

Comments

@YaLTeR
Copy link

YaLTeR commented Sep 6, 2019

0.0.212 (2019-08-20 cd3df6b)

fn f() -> Option<()> {
    let a = Some(1);
    let b = 1i32;
    
    let _ = a.unwrap_or(b.checked_mul(3)?.min(240));
    
    Some(())
}

Suggests doing an unwrap_or_else which doesn't work because of the ?.

Playground

@JohnTitor JohnTitor added C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied labels Sep 7, 2019
bors added a commit that referenced this issue Sep 9, 2019
Fix `or_fun_call` bad suggestion

Closes #4514

changelog: Fix `or_fun_call` bad suggestion
@bors bors closed this as completed in 9bdfd06 Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants