diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/validation.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/validation/match_armlist.rs | 28 |
2 files changed, 0 insertions, 30 deletions
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index 27a465a78..10672d6bf 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs | |||
@@ -3,7 +3,6 @@ mod byte_string; | |||
3 | mod char; | 3 | mod char; |
4 | mod string; | 4 | mod string; |
5 | mod block; | 5 | mod block; |
6 | mod match_armlist; | ||
7 | 6 | ||
8 | use crate::{ | 7 | use crate::{ |
9 | SourceFile, syntax_node::SyntaxError, AstNode, | 8 | SourceFile, syntax_node::SyntaxError, AstNode, |
@@ -20,7 +19,6 @@ pub(crate) fn validate(file: &SourceFile) -> Vec<SyntaxError> { | |||
20 | .visit::<ast::Char, _>(self::char::validate_char_node) | 19 | .visit::<ast::Char, _>(self::char::validate_char_node) |
21 | .visit::<ast::String, _>(self::string::validate_string_node) | 20 | .visit::<ast::String, _>(self::string::validate_string_node) |
22 | .visit::<ast::Block, _>(self::block::validate_block_node) | 21 | .visit::<ast::Block, _>(self::block::validate_block_node) |
23 | .visit::<ast::MatchArmList, _>(self::match_armlist::validate_match_armlist) | ||
24 | .accept(node); | 22 | .accept(node); |
25 | } | 23 | } |
26 | errors | 24 | errors |
diff --git a/crates/ra_syntax/src/validation/match_armlist.rs b/crates/ra_syntax/src/validation/match_armlist.rs deleted file mode 100644 index c43ed7092..000000000 --- a/crates/ra_syntax/src/validation/match_armlist.rs +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | use crate::{ | ||
2 | ast::{self, AttrsOwner, AstNode}, | ||
3 | syntax_node::{ | ||
4 | SyntaxError, | ||
5 | SyntaxErrorKind::*, | ||
6 | Direction, | ||
7 | }, | ||
8 | }; | ||
9 | |||
10 | pub(crate) fn validate_match_armlist(node: &ast::MatchArmList, errors: &mut Vec<SyntaxError>) { | ||
11 | // Report errors for any inner attribute | ||
12 | // which has a preceding matcharm or an outer attribute | ||
13 | for inner_attr in node.attrs().filter(|s| s.is_inner()) { | ||
14 | let any_errors = inner_attr.syntax().siblings(Direction::Prev).any(|s| { | ||
15 | match (ast::MatchArm::cast(s), ast::Attr::cast(s)) { | ||
16 | (Some(_), _) => true, | ||
17 | // Outer attributes which preceed an inner attribute are not allowed | ||
18 | (_, Some(a)) if !a.is_inner() => true, | ||
19 | (_, Some(_)) => false, | ||
20 | (None, None) => false, | ||
21 | } | ||
22 | }); | ||
23 | |||
24 | if any_errors { | ||
25 | errors.push(SyntaxError::new(InvalidMatchInnerAttr, inner_attr.syntax().range())); | ||
26 | } | ||
27 | } | ||
28 | } | ||