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

False positive in unnecessary_unwrap #5174

Closed
JohnTitor opened this issue Feb 13, 2020 · 0 comments · Fixed by #5558
Closed

False positive in unnecessary_unwrap #5174

JohnTitor opened this issue Feb 13, 2020 · 0 comments · Fixed by #5558
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@JohnTitor
Copy link
Member

@flip1995 pointed out this FP in unnecessary_unwrap:

macro_rules! m {
    ($a:expr, $b:expr) => {
         if $a {
              $b;
         }
    }
}

let x: Option<u32> = Some(42);
m!(x.is_some(), x.unwrap());

(playground)

We should also cover this case, it's a follow-up of #5132.

Originally posted by @flip1995 in #5132 (comment)

@JohnTitor JohnTitor added the C-bug Category: Clippy is not doing the correct thing label Feb 13, 2020
bors added a commit that referenced this issue May 2, 2020
Fix `unnecessary_unwrap` lint when checks are done in parameters

Fixes a false positive in `unnecessary_unwrap` lint when checks are done in macro parameters.

FIxes #5174

changelog: Fixes a false positive in `unnecessary_unwrap` lint when checks are done in macro parameters.
@bors bors closed this as completed in 75a7171 May 2, 2020
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

Successfully merging a pull request may close this issue.

1 participant