-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
Summary
Clippy is able to flag these:
a = a + (b * c)a = a - (b * c)
but not their shortform equivalent using the AddAssign/SubAssign operators += and -=, respectively.
Lint Name
suboptimal_flops
Reproducer
I tried this code:
fn main() {
let mut a = 3.0_f32;
let b = 4.0_f32;
let c = 7.0_f32;
a += b * c;
println!("{}", a);
}I expected to see this happen:
Clippy flags with "multiply and add expressions can be calculated more efficiently and accurately"
Instead, this happened:
Nothing happens.
Version
rustc 1.95.0-nightly (d222ddc4d 2026-01-23)
binary: rustc
commit-hash: d222ddc4d90743dfc1e53b610be8fc9d95893d2c
commit-date: 2026-01-23
host: x86_64-pc-windows-msvc
release: 1.95.0-nightly
LLVM version: 21.1.8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't