aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-02-06 00:33:18 +0000
committerVeetaha <[email protected]>2020-02-17 20:24:33 +0000
commit9fdf984958901a6bf16772c2c88b3163f044b390 (patch)
treeb3f86c533c6a9a86a9183cb117e23efd382c045e /crates/ra_syntax/src/validation
parent9053003e3b298b38f6029b860efc5baed1996385 (diff)
ra_syntax: reshape SyntaxError for the sake of removing redundancy
Diffstat (limited to 'crates/ra_syntax/src/validation')
-rw-r--r--crates/ra_syntax/src/validation/block.rs14
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
3use crate::{ 3use 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}