rust-lang/rust-clippy

lint long chains of into/float additions/multiplications

Open

#1,243 opened on Sep 25, 2016

View on GitHub
 (13 comments) (0 reactions) (0 assignees)Rust (1,391 forks)batch import
A-lintL-perfT-ASTgood first issue

Repository metrics

Stars
 (10,406 stars)
PR merge metrics
 (Avg merge 19d 22h) (113 merged PRs in 30d)

Description

In generall, (a+b+c)+(d+e+f) is faster to compute than a+b+c+d+e+f, because the former reduces data dependencies, allowing the CPU to run additions in parallel. For float arithmetic, the tree-like addition may improve numerical stability. Suggest inserting parenthesis.

Contributor guide