ocaml.lang.correctness.physical_vs_structural.physical-not-equal

Author
5,693
Download Count*
License
You probably want the structural inequality operator <>
Run Locally
Run in CI
Defintion
rules:
- id: physical-not-equal
pattern: $X != $Y
message: You probably want the structural inequality operator <>
languages:
- ocaml
severity: WARNING
metadata:
category: correctness
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
Examples
physical_vs_structural.ml
let test xs ys =
(* ruleid:physical-not-equal *)
if xs != ys
then 1
else 2
let test2 xs ys =
(* ruleid:physical-equal *)
if xs == ys
then 1
else 2
Short Link: https://sg.run/nd3r