aboutsummaryrefslogtreecommitdiff
path: root/lib/src/lints/manual_inherit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src/lints/manual_inherit.rs')
-rw-r--r--lib/src/lints/manual_inherit.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/src/lints/manual_inherit.rs b/lib/src/lints/manual_inherit.rs
index 1c10cbf..2d119c3 100644
--- a/lib/src/lints/manual_inherit.rs
+++ b/lib/src/lints/manual_inherit.rs
@@ -7,6 +7,30 @@ use rnix::{
7 NodeOrToken, SyntaxElement, SyntaxKind, 7 NodeOrToken, SyntaxElement, SyntaxKind,
8}; 8};
9 9
10/// ## What it does
11/// Checks for bindings of the form `a = a`.
12///
13/// ## Why is this bad?
14/// If the aim is to bring attributes from a larger scope into
15/// the current scope, prefer an inherit statement.
16///
17/// ## Example
18///
19/// ```
20/// let
21/// a = 2;
22/// in
23/// { a = a; b = 3; }
24/// ```
25///
26/// Try `inherit` instead:
27///
28/// ```
29/// let
30/// a = 2;
31/// in
32/// { inherit a; b = 3; }
33/// ```
10#[lint( 34#[lint(
11 name = "manual inherit", 35 name = "manual inherit",
12 note = "Assignment instead of inherit", 36 note = "Assignment instead of inherit",