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, 9 insertions, 11 deletions
diff --git a/crates/ra_syntax/src/validation/block.rs b/crates/ra_syntax/src/validation/block.rs
index 8e962ab5b..2c08f7e6e 100644
--- a/crates/ra_syntax/src/validation/block.rs
+++ b/crates/ra_syntax/src/validation/block.rs
@@ -6,19 +6,17 @@ use crate::{
6 SyntaxKind::*, 6 SyntaxKind::*,
7}; 7};
8 8
9pub(crate) fn validate_block_expr(expr: ast::BlockExpr, errors: &mut Vec<SyntaxError>) { 9pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
10 if let Some(parent) = expr.syntax().parent() { 10 if let Some(parent) = block.syntax().parent() {
11 match parent.kind() { 11 match parent.kind() {
12 FN_DEF | EXPR_STMT | BLOCK => return, 12 FN_DEF | EXPR_STMT | BLOCK_EXPR => return,
13 _ => {} 13 _ => {}
14 } 14 }
15 } 15 }
16 if let Some(block) = expr.block() { 16 errors.extend(block.attrs().map(|attr| {
17 errors.extend(block.attrs().map(|attr| { 17 SyntaxError::new(
18 SyntaxError::new( 18 "A block in this position cannot accept inner attributes",
19 "A block in this position cannot accept inner attributes", 19 attr.syntax().text_range(),
20 attr.syntax().text_range(), 20 )
21 ) 21 }))
22 }))
23 }
24} 22}