aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/validation.rs')
-rw-r--r--crates/ra_syntax/src/validation.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs
index fdec48fb0..2dddaf09a 100644
--- a/crates/ra_syntax/src/validation.rs
+++ b/crates/ra_syntax/src/validation.rs
@@ -4,7 +4,7 @@ mod block;
4 4
5use crate::{ 5use crate::{
6 ast, match_ast, AstNode, SyntaxError, 6 ast, match_ast, AstNode, SyntaxError,
7 SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN_DEF, INT_NUMBER, STRING, TYPE_ALIAS_DEF}, 7 SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST, FN, INT_NUMBER, STRING, TYPE_ALIAS},
8 SyntaxNode, SyntaxToken, TextSize, T, 8 SyntaxNode, SyntaxToken, TextSize, T,
9}; 9};
10use rustc_lexer::unescape::{ 10use rustc_lexer::unescape::{
@@ -91,7 +91,7 @@ pub(crate) fn validate(root: &SyntaxNode) -> Vec<SyntaxError> {
91 ast::Literal(it) => validate_literal(it, &mut errors), 91 ast::Literal(it) => validate_literal(it, &mut errors),
92 ast::BlockExpr(it) => block::validate_block_expr(it, &mut errors), 92 ast::BlockExpr(it) => block::validate_block_expr(it, &mut errors),
93 ast::FieldExpr(it) => validate_numeric_name(it.name_ref(), &mut errors), 93 ast::FieldExpr(it) => validate_numeric_name(it.name_ref(), &mut errors),
94 ast::RecordField(it) => validate_numeric_name(it.name_ref(), &mut errors), 94 ast::RecordExprField(it) => validate_numeric_name(it.name_ref(), &mut errors),
95 ast::Visibility(it) => validate_visibility(it, &mut errors), 95 ast::Visibility(it) => validate_visibility(it, &mut errors),
96 ast::RangeExpr(it) => validate_range_expr(it, &mut errors), 96 ast::RangeExpr(it) => validate_range_expr(it, &mut errors),
97 ast::PathSegment(it) => validate_path_keywords(it, &mut errors), 97 ast::PathSegment(it) => validate_path_keywords(it, &mut errors),
@@ -200,15 +200,15 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
200 None => return, 200 None => return,
201 }; 201 };
202 match parent.kind() { 202 match parent.kind() {
203 FN_DEF | CONST_DEF | TYPE_ALIAS_DEF => (), 203 FN | CONST | TYPE_ALIAS => (),
204 _ => return, 204 _ => return,
205 } 205 }
206 206
207 let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::ImplDef::cast) { 207 let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::Impl::cast) {
208 Some(it) => it, 208 Some(it) => it,
209 None => return, 209 None => return,
210 }; 210 };
211 if impl_def.target_trait().is_some() { 211 if impl_def.trait_().is_some() {
212 errors.push(SyntaxError::new("Unnecessary visibility qualifier", vis.syntax.text_range())); 212 errors.push(SyntaxError::new("Unnecessary visibility qualifier", vis.syntax.text_range()));
213 } 213 }
214} 214}