diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs index 019ff4663..ae2ddd270 100644 --- a/crates/typst-syntax/src/ast.rs +++ b/crates/typst-syntax/src/ast.rs @@ -108,20 +108,9 @@ impl<'a> Decorator<'a> { } /// The decorator's arguments. - pub fn arguments(self) -> impl DoubleEndedIterator> { - let mut found_non_ident = false; - self.0 - .children() - .filter(move |node| { - // Skip the name (first identifier). - if node.is::() { - return found_non_ident; - } else if !node.kind().is_trivia() { - found_non_ident = true; - } - true - }) - .filter_map(Expr::from_untyped) + /// Currently, they are always strings. + pub fn arguments(self) -> impl DoubleEndedIterator> { + self.0.children().filter_map(Str::from_untyped) } } diff --git a/crates/typst/src/engine.rs b/crates/typst/src/engine.rs index 44e102430..5a26ce886 100644 --- a/crates/typst/src/engine.rs +++ b/crates/typst/src/engine.rs @@ -374,10 +374,7 @@ fn check_decorator_suppresses_warning( } for argument in decorator.arguments() { - let ast::Expr::Str(str) = argument else { - continue; - }; - if warning.name() == str.get() { + if warning.name() == argument.get() { return true; } }