From bb259587056faa3a76eed6e7dae487e1848d841a Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Sun, 17 Feb 2019 20:32:10 +0200 Subject: Remove match_armlist validator --- crates/ra_syntax/src/validation.rs | 2 -- crates/ra_syntax/src/validation/match_armlist.rs | 28 ------------------------ 2 files changed, 30 deletions(-) delete mode 100644 crates/ra_syntax/src/validation/match_armlist.rs 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; mod char; mod string; mod block; -mod match_armlist; use crate::{ SourceFile, syntax_node::SyntaxError, AstNode, @@ -20,7 +19,6 @@ pub(crate) fn validate(file: &SourceFile) -> Vec { .visit::(self::char::validate_char_node) .visit::(self::string::validate_string_node) .visit::(self::block::validate_block_node) - .visit::(self::match_armlist::validate_match_armlist) .accept(node); } 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 @@ -use crate::{ - ast::{self, AttrsOwner, AstNode}, - syntax_node::{ - SyntaxError, - SyntaxErrorKind::*, - Direction, - }, -}; - -pub(crate) fn validate_match_armlist(node: &ast::MatchArmList, errors: &mut Vec) { - // Report errors for any inner attribute - // which has a preceding matcharm or an outer attribute - for inner_attr in node.attrs().filter(|s| s.is_inner()) { - let any_errors = inner_attr.syntax().siblings(Direction::Prev).any(|s| { - match (ast::MatchArm::cast(s), ast::Attr::cast(s)) { - (Some(_), _) => true, - // Outer attributes which preceed an inner attribute are not allowed - (_, Some(a)) if !a.is_inner() => true, - (_, Some(_)) => false, - (None, None) => false, - } - }); - - if any_errors { - errors.push(SyntaxError::new(InvalidMatchInnerAttr, inner_attr.syntax().range())); - } - } -} -- cgit v1.2.3