debug for record field structs

This commit is contained in:
Yoshua Wuyts 2021-08-08 13:50:49 +02:00
parent e2ab2e12a0
commit fd7236c791
3 changed files with 32 additions and 17 deletions

View file

@ -318,6 +318,9 @@ pub fn expr_closure(pats: impl IntoIterator<Item = ast::Param>, expr: ast::Expr)
let params = pats.into_iter().join(", ");
expr_from_text(&format!("|{}| {}", params, expr))
}
pub fn expr_field(receiver: ast::Expr, field: &str) -> ast::Expr {
expr_from_text(&format!("{}.{}", receiver, field))
}
pub fn expr_paren(expr: ast::Expr) -> ast::Expr {
expr_from_text(&format!("({})", expr))
}