aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation/block.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-02 19:27:02 +0100
committerBenjamin Coenen <[email protected]>2020-05-02 19:27:02 +0100
commit4613497a7714c6cd87166e6525d764d75f8acefd (patch)
tree2527ae2c0ef2ef100efee3fcb8899f8e34d0d573 /crates/ra_syntax/src/validation/block.rs
parent19e28888aa41b2845b47adb7314aed99d3c48679 (diff)
parent89e1f97515c36ab97bd378d972cabec0feb6d77e (diff)
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into fix_4202
Diffstat (limited to 'crates/ra_syntax/src/validation/block.rs')
-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}