[moved from #15570]
@dominikh's staticcheck found some bugs in the standard library -- see #15570. This issue is to consider whether it's worth adding a vet check along the same lines.
The check would be to look for expressions of the form (x BOP x), where:
- x is not of type float
- BOP is one of: & && | || == != - / % ^ &^
- x is a side-effect free expression (see the boolean conditions check)
These expressions are either redundant or have a constant value (with some very rare exceptions, like division and the smallest negative integer), which indicates that they are probably a mistake, and in any case would be better written in another way.
cc @robpike for opinions
cc @valyala in case you are interested in playing with more vet checks :)
[moved from #15570]
@dominikh's staticcheck found some bugs in the standard library -- see #15570. This issue is to consider whether it's worth adding a vet check along the same lines.
The check would be to look for expressions of the form (x BOP x), where:
These expressions are either redundant or have a constant value (with some very rare exceptions, like division and the smallest negative integer), which indicates that they are probably a mistake, and in any case would be better written in another way.
cc @robpike for opinions
cc @valyala in case you are interested in playing with more vet checks :)