aboutsummaryrefslogtreecommitdiff
path: root/lib/src/lints/empty_pattern.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-31 16:01:04 +0000
committerAkshay <[email protected]>2021-10-31 16:01:04 +0000
commit15ccd864c8869f87a564e5ab7e923dcc2bb54340 (patch)
tree9d47b230d5d4ad1b0f40ba88f097418b981805a4 /lib/src/lints/empty_pattern.rs
parent4567a246a0b63418f17ead4adc81f5ebab8bdd81 (diff)
add explainations to each lint
Diffstat (limited to 'lib/src/lints/empty_pattern.rs')
-rw-r--r--lib/src/lints/empty_pattern.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/src/lints/empty_pattern.rs b/lib/src/lints/empty_pattern.rs
index ef47c69..5312548 100644
--- a/lib/src/lints/empty_pattern.rs
+++ b/lib/src/lints/empty_pattern.rs
@@ -7,6 +7,33 @@ use rnix::{
7 NodeOrToken, SyntaxElement, SyntaxKind, 7 NodeOrToken, SyntaxElement, SyntaxKind,
8}; 8};
9 9
10/// ## What it does
11/// Checks for an empty variadic pattern: `{...}`, in a function
12/// argument.
13///
14/// ## Why is this bad?
15/// The intention with empty patterns is not instantly obvious. Prefer
16/// an underscore identifier instead, to indicate that the argument
17/// is being ignored.
18///
19/// ## Example
20///
21/// ```
22/// client = { ... }: {
23/// imports = [ self.nixosModules.irmaseal-pkg ];
24/// services.irmaseal-pkg.enable = true;
25/// };
26/// ```
27///
28/// Replace the empty variadic pattern with `_` to indicate that you
29/// intend to ignore the argument:
30///
31/// ```
32/// client = _: {
33/// imports = [ self.nixosModules.irmaseal-pkg ];
34/// services.irmaseal-pkg.enable = true;
35/// };
36/// ```
10#[lint( 37#[lint(
11 name = "empty pattern", 38 name = "empty pattern",
12 note = "Found empty pattern in function argument", 39 note = "Found empty pattern in function argument",