Skip to content

False positive or_fun_call with Result #1280

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

Closed
Riateche opened this issue Oct 14, 2016 · 3 comments
Closed

False positive or_fun_call with Result #1280

Riateche opened this issue Oct 14, 2016 · 3 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@Riateche
Copy link

fn main() {
  let x: Result<String, ()> = Ok("asd".to_string());
  x.unwrap_or(String::new());
}

The message suggests x.unwrap_or_default() but there is no such method for Result. It exists only for Option.

@mcarton
Copy link
Member

mcarton commented Oct 14, 2016

Good catch!
See also rust-lang/rust#37025.

@mcarton mcarton added the C-bug Category: Clippy is not doing the correct thing label Oct 14, 2016
@clarfonthey
Copy link

Actually: https://doc.rust-lang.org/nightly/std/result/enum.Result.html#method.unwrap_or_default

@llogiq
Copy link
Contributor

llogiq commented Jan 15, 2017

I'm closing this as it seems to be working as designed. Please reopen if you disagree.

@llogiq llogiq closed this as completed Jan 15, 2017
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
Projects
None yet
Development

No branches or pull requests

4 participants