ocaml.lang.correctness.useless-eq.useless-equal

Author
169
Download Count*
License
This is always true. If testing for floating point NaN, use Float.is_nan
instead.
Run Locally
Run in CI
Defintion
rules:
- id: useless-equal
pattern: $X = $X
message: This is always true. If testing for floating point NaN, use
`Float.is_nan` instead.
languages:
- ocaml
severity: ERROR
metadata:
category: correctness
technology:
- ocaml
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
Examples
useless-eq.ml
let test a b =
(* ruleid:useless-equal *)
if a+b = a+b
then 1
else 2
Short Link: https://sg.run/L8Z6