special case removing &
suggestion
This commit is contained in:
parent
ca1178f022
commit
b73cdf1b29
4 changed files with 45 additions and 12 deletions
|
@ -1787,6 +1787,14 @@ impl Expr<'_> {
|
|||
expr
|
||||
}
|
||||
|
||||
pub fn peel_borrows(&self) -> &Self {
|
||||
let mut expr = self;
|
||||
while let ExprKind::AddrOf(.., inner) = &expr.kind {
|
||||
expr = inner;
|
||||
}
|
||||
expr
|
||||
}
|
||||
|
||||
pub fn can_have_side_effects(&self) -> bool {
|
||||
match self.peel_drop_temps().kind {
|
||||
ExprKind::Path(_) | ExprKind::Lit(_) => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue