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

blocks_in_if_conditions shouldn't be triggered by a closure #8099

Closed
c410-f3r opened this issue Dec 8, 2021 · 0 comments · Fixed by #8100
Closed

blocks_in_if_conditions shouldn't be triggered by a closure #8099

c410-f3r opened this issue Dec 8, 2021 · 0 comments · Fixed by #8100
Labels
C-bug Category: Clippy is not doing the correct thing good-first-issue These issues are a good way to get started with Clippy I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@c410-f3r
Copy link
Contributor

c410-f3r commented Dec 8, 2021

Summary

Someway somehow a function closure parameter that returns {} triggers blocks_in_if_conditions if the function is wrapped inside an if condition.

Reproducer

fn foo(_: impl FnMut()) -> bool {
    true
}

fn main() {
    // Triggers
    if foo(|| {}) {}

    // Does not trigger
    foo(|| {});
}

Version

rustc 1.59.0-nightly (0b6f079e4 2021-12-07)
binary: rustc
commit-hash: 0b6f079e4987ded15c13a15b734e7cfb8176839f
commit-date: 2021-12-07
host: x86_64-unknown-linux-gnu
release: 1.59.0-nightly
LLVM version: 13.0.0

Additional Labels

No response

@c410-f3r c410-f3r added the C-bug Category: Clippy is not doing the correct thing label Dec 8, 2021
@xFrednet xFrednet added I-false-positive Issue: The lint was triggered on code it shouldn't have good-first-issue These issues are a good way to get started with Clippy labels Dec 8, 2021
@bors bors closed this as completed in aa3648a Dec 10, 2021
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 good-first-issue These issues are a good way to get started with Clippy I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants