Lints and suggestions for the Nix programming language
1
fork

Configure Feed

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

chore: 1-expr tests manual-inherit-from

+62 -43
-8
bin/tests/data/manual_inherit_from.nix
··· 1 - let 2 - a = {b = 2; c = 3;}; 3 - in 4 - { 5 - b = a.b; 6 - c = a.c; 7 - } 8 -
-1
bin/tests/main.rs
··· 44 44 } 45 45 46 46 test_lint! { 47 - manual_inherit_from, 48 47 legacy_let_syntax, 49 48 collapsible_let_in, 50 49 eta_reduction,
+12
bin/tests/manual_inherit_from.rs
··· 1 + mod _utils; 2 + 3 + use macros::generate_tests; 4 + 5 + generate_tests! { 6 + rule: manual_inherit, 7 + expressions: [ 8 + "let a.b = 2; in { b = a.b; }", 9 + "let a.b = 2; in { c = a.c; }", 10 + "let a.b = 2; in { b = a.c; }", 11 + ], 12 + }
-16
bin/tests/snapshots/main__manual_inherit_from_fix.snap
··· 1 - --- 2 - source: bin/tests/main.rs 3 - expression: "&stdout" 4 - --- 5 - --- tests/data/manual_inherit_from.nix 6 - +++ tests/data/manual_inherit_from.nix [fixed] 7 - @@ -1,8 +1,8 @@ 8 - let 9 - a = {b = 2; c = 3;}; 10 - in 11 - { 12 - - b = a.b; 13 - - c = a.c; 14 - + inherit (a) b; 15 - + inherit (a) c; 16 - }
-18
bin/tests/snapshots/main__manual_inherit_from_lint.snap
··· 1 - --- 2 - source: bin/tests/main.rs 3 - expression: "&stdout" 4 - --- 5 - [W04] Warning: Assignment instead of inherit from 6 - ╭─[tests/data/manual_inherit_from.nix:5:3] 7 - 8 - 5 │ b = a.b; 9 - · ────┬─── 10 - · ╰───── This assignment is better written with inherit 11 - ───╯ 12 - [W04] Warning: Assignment instead of inherit from 13 - ╭─[tests/data/manual_inherit_from.nix:6:3] 14 - 15 - 6 │ c = a.c; 16 - · ────┬─── 17 - · ╰───── This assignment is better written with inherit 18 - ───╯
+5
bin/tests/snapshots/manual_inherit_from__fix_a1dd16d76c1e3a76c0da83256a89a945dccc51f490fd14269722a647f8cda9ad.snap
··· 1 + --- 2 + source: bin/tests/manual_inherit_from.rs 3 + expression: "\"let a.b = 2; in { b = a.c; }\"" 4 + --- 5 +
+9
bin/tests/snapshots/manual_inherit_from__fix_d185f6bcc057384cb2f1ae3abb567fd17572eaaa2c3209abd0f527f3fe7e26a1.snap
··· 1 + --- 2 + source: bin/tests/manual_inherit_from.rs 3 + expression: "\"let a.b = 2; in { b = a.b; }\"" 4 + --- 5 + --- <temp_file_path> 6 + +++ <temp_file_path> [fixed] 7 + @@ -1 +1 @@ 8 + -let a.b = 2; in { b = a.b; } 9 + +let a.b = 2; in { inherit (a) b; }
+9
bin/tests/snapshots/manual_inherit_from__fix_fddffc3b779f8727d3ce7613925d3d3df2bc6cc9a30841fe104e26219ed72187.snap
··· 1 + --- 2 + source: bin/tests/manual_inherit_from.rs 3 + expression: "\"let a.b = 2; in { c = a.c; }\"" 4 + --- 5 + --- <temp_file_path> 6 + +++ <temp_file_path> [fixed] 7 + @@ -1 +1 @@ 8 + -let a.b = 2; in { c = a.c; } 9 + +let a.b = 2; in { inherit (a) c; }
+5
bin/tests/snapshots/manual_inherit_from__lint_a1dd16d76c1e3a76c0da83256a89a945dccc51f490fd14269722a647f8cda9ad.snap
··· 1 + --- 2 + source: bin/tests/manual_inherit_from.rs 3 + expression: "\"let a.b = 2; in { b = a.c; }\"" 4 + --- 5 +
+11
bin/tests/snapshots/manual_inherit_from__lint_d185f6bcc057384cb2f1ae3abb567fd17572eaaa2c3209abd0f527f3fe7e26a1.snap
··· 1 + --- 2 + source: bin/tests/manual_inherit_from.rs 3 + expression: "\"let a.b = 2; in { b = a.b; }\"" 4 + --- 5 + [W04] Warning: Assignment instead of inherit from 6 + ╭─[<temp_file_path>:1:19] 7 + 8 + 1 │ let a.b = 2; in { b = a.b; } 9 + · ────┬─── 10 + · ╰───── This assignment is better written with inherit 11 + ───╯
+11
bin/tests/snapshots/manual_inherit_from__lint_fddffc3b779f8727d3ce7613925d3d3df2bc6cc9a30841fe104e26219ed72187.snap
··· 1 + --- 2 + source: bin/tests/manual_inherit_from.rs 3 + expression: "\"let a.b = 2; in { c = a.c; }\"" 4 + --- 5 + [W04] Warning: Assignment instead of inherit from 6 + ╭─[<temp_file_path>:1:19] 7 + 8 + 1 │ let a.b = 2; in { c = a.c; } 9 + · ────┬─── 10 + · ╰───── This assignment is better written with inherit 11 + ───╯