Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ea9ccfa

Browse files
committed
fix clippy::while_let_loop: use while let{} instead of loop { if ... break; }
1 parent f95cfe5 commit ea9ccfa

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/librustc_typeck/check/place_op.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
200200
// Gather up expressions we want to munge.
201201
let mut exprs = vec![expr];
202202

203-
loop {
204-
match exprs.last().unwrap().kind {
205-
hir::ExprKind::Field(ref expr, _)
206-
| hir::ExprKind::Index(ref expr, _)
207-
| hir::ExprKind::Unary(hir::UnOp::UnDeref, ref expr) => exprs.push(&expr),
208-
_ => break,
209-
}
203+
while let hir::ExprKind::Field(ref expr, _)
204+
| hir::ExprKind::Index(ref expr, _)
205+
| hir::ExprKind::Unary(hir::UnOp::UnDeref, ref expr) = exprs.last().unwrap().kind
206+
{
207+
exprs.push(&expr);
210208
}
211209

212210
debug!("convert_place_derefs_to_mutable: exprs={:?}", exprs);

0 commit comments

Comments
 (0)