1
Fork 0

Rollup merge of #99119 - TaKO8Ki:remove-string-matching-about-methods, r=cjgillot

Refactor: remove a string matching about methods

This patch remove a string matching about methods and adds some rustfix tests.
This commit is contained in:
Dylan DPC 2022-07-15 15:53:38 +05:30 committed by GitHub
commit 24f0e1499e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 130 additions and 80 deletions

View file

@ -1824,6 +1824,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.