diff --git a/bin/tests/data/bool_comparison.nix b/bin/tests/data/bool_comparison.nix index 00a1284..28b3b1e 100644 --- a/bin/tests/data/bool_comparison.nix +++ b/bin/tests/data/bool_comparison.nix @@ -20,4 +20,8 @@ (false == true) (true == false) (true == true) + + # has attr + (false == m ? n) + (true == o ? p) ] diff --git a/bin/tests/snapshots/main__bool_comparison_fix.snap b/bin/tests/snapshots/main__bool_comparison_fix.snap index 1f5c041..614e9af 100644 --- a/bin/tests/snapshots/main__bool_comparison_fix.snap +++ b/bin/tests/snapshots/main__bool_comparison_fix.snap @@ -4,7 +4,7 @@ expression: "& stdout" --- --- tests/data/bool_comparison.nix +++ tests/data/bool_comparison.nix [fixed] -@@ -1,23 +1,23 @@ +@@ -1,27 +1,27 @@ [ # trivial - (a == true) @@ -39,4 +39,10 @@ expression: "& stdout" + (!true) + false + true + + # has attr +- (false == m ? n) +- (true == o ? p) ++ (!m ? n) ++ (o ? p) ] diff --git a/bin/tests/snapshots/main__bool_comparison_lint.snap b/bin/tests/snapshots/main__bool_comparison_lint.snap index cd8ced2..7b8a5aa 100644 --- a/bin/tests/snapshots/main__bool_comparison_lint.snap +++ b/bin/tests/snapshots/main__bool_comparison_lint.snap @@ -86,3 +86,17 @@ expression: "& out" · ──────┬───── · ╰─────── Comparing true with boolean literal true ────╯ +[W01] Warning: Unnecessary comparison with boolean + ╭─[data/bool_comparison.nix:25:4] + │ + 25 │ (false == m ? n) + · ───────┬────── + · ╰──────── Comparing m ? n with boolean literal false +────╯ +[W01] Warning: Unnecessary comparison with boolean + ╭─[data/bool_comparison.nix:26:4] + │ + 26 │ (true == o ? p) + · ──────┬────── + · ╰──────── Comparing o ? p with boolean literal true +────╯