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_from.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/src/lints/manual_inherit_from.rs') diff --git a/lib/src/lints/manual_inherit_from.rs b/lib/src/lints/manual_inherit_from.rs index 146d55b..8d0f539 100644 --- a/lib/src/lints/manual_inherit_from.rs +++ b/lib/src/lints/manual_inherit_from.rs @@ -7,6 +7,30 @@ use rnix::{ NodeOrToken, SyntaxElement, SyntaxKind, }; +/// ## What it does +/// Checks for bindings of the form `a = someAttr.a`. +/// +/// ## Why is this bad? +/// If the aim is to extract or bring attributes of an attrset into +/// scope, prefer an inherit statement. +/// +/// ## Example +/// +/// ``` +/// let +/// mtl = pkgs.haskellPackages.mtl; +/// in +/// null +/// ``` +/// +/// Try `inherit` instead: +/// +/// ``` +/// let +/// inherit (pkgs.haskellPackages) mtl; +/// in +/// null +/// ``` #[lint( name = "manual inherit from", note = "Assignment instead of inherit from", -- cgit v1.2.3