while let unwrap_group

This commit is contained in:
David Hewitt 2021-06-24 09:11:27 +01:00
parent 08802e2024
commit 67948a24f7

View file

@ -118,9 +118,9 @@ pub fn ensure_not_async_fn(sig: &syn::Signature) -> syn::Result<()> {
Ok(())
}
pub fn unwrap_group(expr: &syn::Expr) -> &syn::Expr {
match expr {
syn::Expr::Group(syn::ExprGroup { expr, .. }) => &*expr,
other => other,
pub fn unwrap_group(mut expr: &syn::Expr) -> &syn::Expr {
while let syn::Expr::Group(g) = expr {
expr = &*g.expr;
}
expr
}