Remove useless borrows and derefs

This commit is contained in:
Maybe Waffle 2022-11-29 11:01:17 +00:00
parent 9c0bc3028a
commit f2b97a8bfe
41 changed files with 145 additions and 146 deletions

View file

@ -1179,7 +1179,7 @@ impl Expr {
pub fn peel_parens(&self) -> &Expr {
let mut expr = self;
while let ExprKind::Paren(inner) = &expr.kind {
expr = &inner;
expr = inner;
}
expr
}
@ -2027,7 +2027,7 @@ impl Ty {
pub fn peel_refs(&self) -> &Self {
let mut final_ty = self;
while let TyKind::Rptr(_, MutTy { ty, .. }) = &final_ty.kind {
final_ty = &ty;
final_ty = ty;
}
final_ty
}