ocaml.lang.correctness.useless-if.ocamllint-useless-if

Author
169
Download Count*
License
Useless if. Both branches are equal.
Run Locally
Run in CI
Defintion
rules:
- id: ocamllint-useless-if
pattern: if $X then $E else $E
message: Useless if. Both branches are equal.
languages:
- ocaml
severity: ERROR
metadata:
category: correctness
technology:
- ocaml
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
Examples
useless-if.ml
let test a b =
(* ruleid:ocamllint-useless-if *)
if foo
then a+b
else a+b
Short Link: https://sg.run/8ReN