From 4f2134cc33f07c09fe166cec42971828843bc0ef Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 May 2020 01:18:19 +0200 Subject: Introduce EffectExpr --- crates/ra_syntax/src/validation/block.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'crates/ra_syntax/src/validation') 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::{ SyntaxKind::*, }; -pub(crate) fn validate_block_expr(expr: ast::BlockExpr, errors: &mut Vec) { - if let Some(parent) = expr.syntax().parent() { +pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec) { + if let Some(parent) = block.syntax().parent() { match parent.kind() { - FN_DEF | EXPR_STMT | BLOCK => return, + FN_DEF | EXPR_STMT | BLOCK_EXPR => return, _ => {} } } - if let Some(block) = expr.block() { - errors.extend(block.attrs().map(|attr| { - SyntaxError::new( - "A block in this position cannot accept inner attributes", - attr.syntax().text_range(), - ) - })) - } + errors.extend(block.attrs().map(|attr| { + SyntaxError::new( + "A block in this position cannot accept inner attributes", + attr.syntax().text_range(), + ) + })) } -- cgit v1.2.3