···11-let
22-in
33- null
11+[
22+ (
33+ let
44+ in
55+ null
66+ )
77+ (
88+ let
99+ # don't match this, we have a comment
1010+ in
1111+ null
1212+ )
1313+]
+5-5
bin/tests/snapshots/main__empty_let_in.snap
···4455---
66[W02] Warning: Useless let-in expression
77- ╭─[data/empty_let_in.nix:1:1]
77+ ╭─[data/empty_let_in.nix:3:5]
88 │
99- 1 │ ╭─▶ let
1010- 3 │ ├─▶ null
1111- · │
1212- · ╰──────────── This let-in expression has no entries
99+ 3 │ ╭─▶ let
1010+ 5 │ ├─▶ null
1111+ · │
1212+ · ╰────────────── This let-in expression has no entries
1313───╯
1414
+8
lib/src/lints/empty_let_in.rs
···11+use std::ops::Not;
22+13use crate::{session::SessionInfo, Metadata, Report, Rule, Suggestion};
2435use if_chain::if_chain;
···4547 if inherits.count() == 0;
46484749 if let Some(body) = let_in_expr.body();
5050+5151+ // ensure that the let-in-expr does not have comments
5252+ if node
5353+ .children_with_tokens()
5454+ .any(|el| el.kind() == SyntaxKind::TOKEN_COMMENT)
5555+ .not();
4856 then {
4957 let at = node.text_range();
5058 let replacement = body;