diff options
Diffstat (limited to 'lib/src/lints/redundant_pattern_bind.rs')
-rw-r--r-- | lib/src/lints/redundant_pattern_bind.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/src/lints/redundant_pattern_bind.rs b/lib/src/lints/redundant_pattern_bind.rs index ad1aba8..5b0711f 100644 --- a/lib/src/lints/redundant_pattern_bind.rs +++ b/lib/src/lints/redundant_pattern_bind.rs | |||
@@ -7,10 +7,29 @@ use rnix::{ | |||
7 | NodeOrToken, SyntaxElement, SyntaxKind, | 7 | NodeOrToken, SyntaxElement, SyntaxKind, |
8 | }; | 8 | }; |
9 | 9 | ||
10 | /// ## What it does | ||
11 | /// Checks for binds of the form `inputs @ { ... }` in function | ||
12 | /// arguments. | ||
13 | /// | ||
14 | /// ## Why is this bad? | ||
15 | /// The variadic pattern here is redundant, as it does not capture | ||
16 | /// anything. | ||
17 | /// | ||
18 | /// ## Example | ||
19 | /// | ||
20 | /// ``` | ||
21 | /// inputs @ { ... }: inputs.nixpkgs | ||
22 | /// ``` | ||
23 | /// | ||
24 | /// Remove the pattern altogether: | ||
25 | /// | ||
26 | /// ``` | ||
27 | /// inputs: inputs.nixpkgs | ||
28 | /// ``` | ||
10 | #[lint( | 29 | #[lint( |
11 | name = "redundant pattern bind", | 30 | name = "redundant pattern bind", |
12 | note = "Found redundant pattern bind in function argument", | 31 | note = "Found redundant pattern bind in function argument", |
13 | code = 10, | 32 | code = 11, |
14 | match_with = SyntaxKind::NODE_PATTERN | 33 | match_with = SyntaxKind::NODE_PATTERN |
15 | )] | 34 | )] |
16 | struct RedundantPatternBind; | 35 | struct RedundantPatternBind; |