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