Redundant boolean expressions are boolean expressions that are either always
true
, or always false
. Such boolean expressions can be simplified, which may
improve a readability of the code. In some cases, this also indicates a presence
of other issues.
func foo(a bool) {
_ = a || true
_ = a && false
}
func foo(_ bool) {
_ = true
_ = false
}