apply suggested improvements

This commit is contained in:
PgBiel 2024-07-29 16:20:55 -03:00
parent 93bd46da8f
commit af7e258f80
2 changed files with 5 additions and 13 deletions

View File

@ -359,9 +359,10 @@ impl Lexer<'_> {
if ident == "allow" { if ident == "allow" {
SyntaxKind::AnnotationName SyntaxKind::AnnotationName
} else { } else {
let error = self.error(eco_format!("invalid annotation name")); self.error(eco_format!("invalid annotation name"));
self.hint("must be 'allow'"); self.hint("must be 'allow'");
error
SyntaxKind::Error
} }
} }

View File

@ -537,17 +537,8 @@ fn check_annotation_suppresses_warning(
annotation: ast::Annotation, annotation: ast::Annotation,
warning: &str, warning: &str,
) -> bool { ) -> bool {
if annotation.name().as_str() != "allow" { annotation.name().as_str() == "allow"
return false; && annotation.arguments().any(|arg| arg.get() == warning)
}
for argument in annotation.arguments() {
if warning == argument.get() {
return true;
}
}
false
} }
/// A result type with a file-related error. /// A result type with a file-related error.