aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/validation')
-rw-r--r--crates/ra_syntax/src/validation/match_armlist.rs28
1 files changed, 0 insertions, 28 deletions
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 @@
1use crate::{
2 ast::{self, AttrsOwner, AstNode},
3 syntax_node::{
4 SyntaxError,
5 SyntaxErrorKind::*,
6 Direction,
7 },
8};
9
10pub(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}