aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/validation')
-rw-r--r--crates/ra_syntax/src/validation/block.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/validation/block.rs b/crates/ra_syntax/src/validation/block.rs
index c5588658d..3c9e96eb3 100644
--- a/crates/ra_syntax/src/validation/block.rs
+++ b/crates/ra_syntax/src/validation/block.rs
@@ -5,18 +5,18 @@ use crate::{
5 SyntaxKind::*, 5 SyntaxKind::*,
6}; 6};
7 7
8pub(crate) fn validate_block_node(node: ast::Block, errors: &mut Vec<SyntaxError>) { 8pub(crate) fn validate_block_expr(expr: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
9 if let Some(parent) = node.syntax().parent() { 9 if let Some(parent) = expr.syntax().parent() {
10 match parent.kind() { 10 match parent.kind() {
11 FN_DEF => return, 11 FN_DEF | EXPR_STMT | BLOCK => return,
12 BLOCK_EXPR => match parent.parent().map(|v| v.kind()) {
13 Some(EXPR_STMT) | Some(BLOCK) => return,
14 _ => {}
15 },
16 _ => {} 12 _ => {}
17 } 13 }
18 } 14 }
19 errors.extend( 15 if let Some(block) = expr.block() {
20 node.attrs().map(|attr| SyntaxError::new(InvalidBlockAttr, attr.syntax().text_range())), 16 errors.extend(
21 ) 17 block
18 .attrs()
19 .map(|attr| SyntaxError::new(InvalidBlockAttr, attr.syntax().text_range())),
20 )
21 }
22} 22}