- Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.Call for participation: Medium difficulty level problem and requires some initial experience.I-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Lint name: suspicious use of binary operator
I tried this code (uses impl_ops crate):
impl_op_ex!(- |a : &Struct, b : &Struct| -> Struct{ if a.getA() == b.getA() && a.getB() == b.getB() { return Struct::new(a.getData() - b.getData(), a.getA(), a.getB()); } todo!("A or B change on substraction is not yet supported"); });
I expected to see this happen: no error or warning is thrown
Instead, this happened: error is thrown on the &&
logical operator in the if
expression
Meta
cargo clippy -V
: clippy 0.0.212 (cb75ad5d 2021-02-10)rustc -Vv
:rustc 1.50.0 (cb75ad5db 2021-02-10) binary: rustc commit-hash: cb75ad5db02783e8b0222fee363c5f63f7e2cf5b commit-date: 2021-02-10 host: x86_64-pc-windows-msvc release: 1.50.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.Call for participation: Medium difficulty level problem and requires some initial experience.I-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have