mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
apply suggested improvements
This commit is contained in:
parent
93bd46da8f
commit
af7e258f80
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user