- Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed as not planned
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-bugIssue: The suggestion compiles but changes the code to behave in an unintended wayIssue: The suggestion compiles but changes the code to behave in an unintended way
Description
Summary
_ = (return) || true
suggests being replaced with true
Lint Name
overly_complex_bool_expr
Reproducer
I tried this code:
#![allow(unreachable_code, clippy::never_loop, clippy::diverging_sub_expression)] fn main() { _ = (return) || true; }
I saw this happen:
error: this boolean expression contains a logic bug --> src/main.rs:3:9 | 3 | _ = (return) || true; | ^^^^^^^^^^^^^^^^ help: it would look like the following: `true` | help: this expression can be optimized out by applying boolean operations to the outer expression --> src/main.rs:3:9 | 3 | _ = (return) || true; | ^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#overly_complex_bool_expr = note: `#[deny(clippy::overly_complex_bool_expr)]` on by defau
I expected to see this happen:
Version
rustc 1.80.0-nightly (c987ad527 2024-05-01) binary: rustc commit-hash: c987ad527540e8f1565f57c31204bde33f63df76 commit-date: 2024-05-01 host: x86_64-unknown-linux-gnu release: 1.80.0-nightly LLVM version: 18.1.4
Additional Labels
@rustbot label +I-suggestion-causes-bug
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-bugIssue: The suggestion compiles but changes the code to behave in an unintended wayIssue: The suggestion compiles but changes the code to behave in an unintended way