Remove match_armlist validator

This commit is contained in:
Ville Penttinen 2019-02-17 20:32:10 +02:00
parent 96e3ac389f
commit bb25958705
2 changed files with 0 additions and 30 deletions

View File

@ -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<SyntaxError> {
.visit::<ast::Char, _>(self::char::validate_char_node)
.visit::<ast::String, _>(self::string::validate_string_node)
.visit::<ast::Block, _>(self::block::validate_block_node)
.visit::<ast::MatchArmList, _>(self::match_armlist::validate_match_armlist)
.accept(node);
}
errors

View File

@ -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<SyntaxError>) {
// 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()));
}
}
}