Support flattening/inlining format_args through & and ().
E.g. format_args!("{}", &(format_args!("abc"))).
This commit is contained in:
parent
85ef2f0cfe
commit
caa6ba9e86
2 changed files with 21 additions and 6 deletions
|
@ -1184,6 +1184,15 @@ impl Expr {
|
|||
expr
|
||||
}
|
||||
|
||||
pub fn peel_parens_and_refs(&self) -> &Expr {
|
||||
let mut expr = self;
|
||||
while let ExprKind::Paren(inner) | ExprKind::AddrOf(BorrowKind::Ref, _, inner) = &expr.kind
|
||||
{
|
||||
expr = inner;
|
||||
}
|
||||
expr
|
||||
}
|
||||
|
||||
/// Attempts to reparse as `Ty` (for diagnostic purposes).
|
||||
pub fn to_ty(&self) -> Option<P<Ty>> {
|
||||
let kind = match &self.kind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue