From 15ccd864c8869f87a564e5ab7e923dcc2bb54340 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 31 Oct 2021 21:31:04 +0530 Subject: add explainations to each lint --- lib/src/lints/manual_inherit.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/src/lints/manual_inherit.rs') 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::{ NodeOrToken, SyntaxElement, SyntaxKind, }; +/// ## What it does +/// Checks for bindings of the form `a = a`. +/// +/// ## Why is this bad? +/// If the aim is to bring attributes from a larger scope into +/// the current scope, prefer an inherit statement. +/// +/// ## Example +/// +/// ``` +/// let +/// a = 2; +/// in +/// { a = a; b = 3; } +/// ``` +/// +/// Try `inherit` instead: +/// +/// ``` +/// let +/// a = 2; +/// in +/// { inherit a; b = 3; } +/// ``` #[lint( name = "manual inherit", note = "Assignment instead of inherit", -- cgit v1.2.3