recursively look for literal in test macro
This commit is contained in:
parent
293c55ce89
commit
ef039c5d67
1 changed files with 13 additions and 1 deletions
|
@ -244,7 +244,19 @@ fn parse_args(attr_args: AttributeArgs) -> syn::Result<Args> {
|
|||
));
|
||||
}
|
||||
|
||||
let Expr::Lit(syn::ExprLit { lit, .. }) = value.value else {
|
||||
fn recurse_lit_lookup(expr: Expr) -> Option<Lit> {
|
||||
match expr {
|
||||
Expr::Lit(syn::ExprLit { lit, .. }) => {
|
||||
return Some(lit);
|
||||
}
|
||||
Expr::Group(syn::ExprGroup { expr, .. }) => {
|
||||
return recurse_lit_lookup(*expr);
|
||||
}
|
||||
_ => return None,
|
||||
}
|
||||
}
|
||||
|
||||
let Some(lit) = recurse_lit_lookup(value.value) else {
|
||||
return Err(syn::Error::new_spanned(path, "expected string for `false`"));
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue