aboutsummaryrefslogtreecommitdiff
path: root/lib/src/lints/empty_let_in.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src/lints/empty_let_in.rs')
-rw-r--r--lib/src/lints/empty_let_in.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/src/lints/empty_let_in.rs b/lib/src/lints/empty_let_in.rs
index e42f658..390a1e1 100644
--- a/lib/src/lints/empty_let_in.rs
+++ b/lib/src/lints/empty_let_in.rs
@@ -1,3 +1,5 @@
1use std::ops::Not;
2
1use crate::{session::SessionInfo, Metadata, Report, Rule, Suggestion}; 3use crate::{session::SessionInfo, Metadata, Report, Rule, Suggestion};
2 4
3use if_chain::if_chain; 5use if_chain::if_chain;
@@ -45,6 +47,12 @@ impl Rule for EmptyLetIn {
45 if inherits.count() == 0; 47 if inherits.count() == 0;
46 48
47 if let Some(body) = let_in_expr.body(); 49 if let Some(body) = let_in_expr.body();
50
51 // ensure that the let-in-expr does not have comments
52 if node
53 .children_with_tokens()
54 .any(|el| el.kind() == SyntaxKind::TOKEN_COMMENT)
55 .not();
48 then { 56 then {
49 let at = node.text_range(); 57 let at = node.text_range();
50 let replacement = body; 58 let replacement = body;