6

Demote float_cmp to pedantic by workingjubilee · Pull Request #7692 · rust-lang/...

 3 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/7692
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

workingjubilee commented 22 days ago

edited

See this issue: #7666

This is one of the most frequently suppressed lints. It is deny-by-default. It is not actually clearly wrong, as there are many instances where direct float comparison is actually desirable. It is only after operating on floats that they may lose precision, and that depends greatly on the operation. As most correctness lints have a much higher standard of error, being based on hard and fast binary logic, this should not be amongst them.

A linter is not a substitute for observing the math carefully and running tests, and doing the desirable thing is even more likely to lead one to want exact comparisons.

changelog: Demote [float_cmp] from correctness to pedantic lints


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK