Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(useless_parens): selects in list

Co-authored-by: Shahar "Dawn" Or <mightyiampresence@gmail.com>

authored by

Wes Gray
Shahar "Dawn" Or
and committed by
Shahar "Dawn" Or
32b67e8f 23dba021

+28 -8
+6
bin/tests/data/useless_parens.nix
··· 14 14 in 15 15 # parens around let body 16 16 (null) 17 + 18 + # select in list (parens not necessary) 19 + [ 20 + (a.b) 21 + (a.b or g) 22 + ]
+8 -1
bin/tests/snapshots/main__useless_parens_fix.snap
··· 4 4 --- 5 5 --- tests/data/useless_parens.nix 6 6 +++ tests/data/useless_parens.nix [fixed] 7 - @@ -1,16 +1,16 @@ 7 + @@ -1,22 +1,22 @@ 8 8 let 9 9 # parens around primitives 10 10 a = { ··· 27 27 # parens around let body 28 28 - (null) 29 29 + null 30 + 31 + # select in list (parens not necessary) 32 + [ 33 + - (a.b) 34 + + a.b 35 + (a.b or g) 36 + ]
+14 -7
bin/tests/snapshots/main__useless_parens_lint.snap
··· 3 3 expression: "& out" 4 4 --- 5 5 [W08] Warning: These parentheses can be omitted 6 - ╭─[data/useless_parens.nix:16:3] 7 - 8 - 16 │ (null) 9 - · ───┬── 10 - · ╰──── Useless parentheses around body of let expression 11 - ────╯ 12 - [W08] Warning: These parentheses can be omitted 13 6 ╭─[data/useless_parens.nix:4:9] 14 7 15 8 4 │ b = ("hello"); ··· 44 37 · ────────┬─────── 45 38 · ╰───────── Useless parentheses around value in binding 46 39 ────╯ 40 + [W08] Warning: These parentheses can be omitted 41 + ╭─[data/useless_parens.nix:16:3] 42 + 43 + 16 │ (null) 44 + · ───┬── 45 + · ╰──── Useless parentheses around primitive expression 46 + ────╯ 47 + [W08] Warning: These parentheses can be omitted 48 + ╭─[data/useless_parens.nix:20:5] 49 + 50 + 20 │ (a.b) 51 + · ──┬── 52 + · ╰──── Useless parentheses around primitive expression 53 + ────╯