ocaml.lang.correctness.useless_eq.useless-equal

Author
5,693
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
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/EkPB