diff options
Diffstat (limited to 'crates/ra_syntax/src/validation')
-rw-r--r-- | crates/ra_syntax/src/validation/block.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/validation/block.rs b/crates/ra_syntax/src/validation/block.rs index c85bbc1f4..8e962ab5b 100644 --- a/crates/ra_syntax/src/validation/block.rs +++ b/crates/ra_syntax/src/validation/block.rs | |||
@@ -1,9 +1,8 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! Logic for validating block expressions i.e. `ast::BlockExpr`. |
2 | 2 | ||
3 | use crate::{ | 3 | use crate::{ |
4 | ast::{self, AstNode, AttrsOwner}, | 4 | ast::{self, AstNode, AttrsOwner}, |
5 | SyntaxError, | 5 | SyntaxError, |
6 | SyntaxErrorKind::*, | ||
7 | SyntaxKind::*, | 6 | SyntaxKind::*, |
8 | }; | 7 | }; |
9 | 8 | ||
@@ -15,10 +14,11 @@ pub(crate) fn validate_block_expr(expr: ast::BlockExpr, errors: &mut Vec<SyntaxE | |||
15 | } | 14 | } |
16 | } | 15 | } |
17 | if let Some(block) = expr.block() { | 16 | if let Some(block) = expr.block() { |
18 | errors.extend( | 17 | errors.extend(block.attrs().map(|attr| { |
19 | block | 18 | SyntaxError::new( |
20 | .attrs() | 19 | "A block in this position cannot accept inner attributes", |
21 | .map(|attr| SyntaxError::new(InvalidBlockAttr, attr.syntax().text_range())), | 20 | attr.syntax().text_range(), |
22 | ) | 21 | ) |
22 | })) | ||
23 | } | 23 | } |
24 | } | 24 | } |