From c7874ec26d6499a1196ce23432beb33764490dec Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 20 Feb 2022 10:55:20 +0530 Subject: new lint: useless_has_attr --- bin/tests/snapshots/main__useless_has_attr.snap | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 bin/tests/snapshots/main__useless_has_attr.snap (limited to 'bin/tests/snapshots') diff --git a/bin/tests/snapshots/main__useless_has_attr.snap b/bin/tests/snapshots/main__useless_has_attr.snap new file mode 100644 index 0000000..df72eaf --- /dev/null +++ b/bin/tests/snapshots/main__useless_has_attr.snap @@ -0,0 +1,34 @@ +--- +source: bin/tests/main.rs +expression: "&out" + +--- +[W19] Warning: This `if` expression can be simplified with `or` + ╭─[data/useless_has_attr.nix:3:4] + │ + 3 │ (if x ? a then x.a else default) + · ───────────────┬────────────── + · ╰──────────────── Consider using x.a or default instead of this if expression +───╯ +[W19] Warning: This `if` expression can be simplified with `or` + ╭─[data/useless_has_attr.nix:4:4] + │ + 4 │ (if x.a ? b then x.a.b else default) + · ─────────────────┬──────────────── + · ╰────────────────── Consider using x.a.b or default instead of this if expression +───╯ +[W19] Warning: This `if` expression can be simplified with `or` + ╭─[data/useless_has_attr.nix:5:4] + │ + 5 │ (if x ? a.b then x.a.b else default) + · ─────────────────┬──────────────── + · ╰────────────────── Consider using x.a.b or default instead of this if expression +───╯ +[W19] Warning: This `if` expression can be simplified with `or` + ╭─[data/useless_has_attr.nix:8:4] + │ + 8 │ (if x ? a then x.a else if b then c else d) + · ────────────────────┬──────────────────── + · ╰────────────────────── Consider using x.a or (if b then c else d) instead of this if expression +───╯ + -- cgit v1.2.3