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" {
SyntaxKind::AnnotationName
} else {
let error = self.error(eco_format!("invalid annotation name"));
self.error(eco_format!("invalid annotation name"));
self.hint("must be 'allow'");
error
SyntaxKind::Error
}
}

View File

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