1
Fork 0

simplify suggest_deref_ref_or_into

This commit is contained in:
Takayuki Maeda 2022-07-15 14:29:15 +09:00
parent 1599c5a821
commit 45b88aff10
3 changed files with 49 additions and 47 deletions

View file

@ -1811,6 +1811,14 @@ impl Expr<'_> {
_ => false,
}
}
pub fn method_ident(&self) -> Option<Ident> {
match self.kind {
ExprKind::MethodCall(receiver_method, ..) => Some(receiver_method.ident),
ExprKind::Unary(_, expr) | ExprKind::AddrOf(.., expr) => expr.method_ident(),
_ => None,
}
}
}
/// Checks if the specified expression is a built-in range literal.