Use .as_ref() in lieu of &** (#5874)

I find this less opaque (and often more succinct).
This commit is contained in:
Charlie Marsh 2023-07-18 20:49:13 -04:00 committed by GitHub
parent 7ffcd93afd
commit 626d8dc2cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 21 deletions

View file

@ -44,8 +44,8 @@ pub enum PythonType {
impl From<&Expr> for PythonType {
fn from(expr: &Expr) -> Self {
match expr {
Expr::NamedExpr(ast::ExprNamedExpr { value, .. }) => (&**value).into(),
Expr::UnaryOp(ast::ExprUnaryOp { operand, .. }) => (&**operand).into(),
Expr::NamedExpr(ast::ExprNamedExpr { value, .. }) => (value.as_ref()).into(),
Expr::UnaryOp(ast::ExprUnaryOp { operand, .. }) => (operand.as_ref()).into(),
Expr::Dict(_) => PythonType::Dict,
Expr::DictComp(_) => PythonType::Dict,
Expr::Set(_) => PythonType::Set,