no_self_comparisons

SeverityQuick FixOptions
Warning

Details

DO avoid self comparisons.

Bad
if (foo == foo) {}
if (foo.property == foo.property) {}
Good
if (foo == bar) {}
if (foo.property == bar.property) {}

Usage

To enable the no_self_comparisons rule, add no_self_comparisons under custom_lint > rules in your analysis_options.yaml file:

custom_lint:
  rules:
    - no_self_comparisons