about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-08-07 23:59:59 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2020-08-08 00:57:09 +0200
commitea9ccfa42c0cd439042c251fc97fa8f160c3e272 (patch)
tree4aae0d107b1c6995dff1cb33528d97bff7cca666 /src
parentf95cfe573a66e98e3f5becc3f0aa346271992d17 (diff)
downloadrust-ea9ccfa42c0cd439042c251fc97fa8f160c3e272.tar.gz
rust-ea9ccfa42c0cd439042c251fc97fa8f160c3e272.zip
fix clippy::while_let_loop: use while let{} instead of loop { if ... break; }
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/check/place_op.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/librustc_typeck/check/place_op.rs b/src/librustc_typeck/check/place_op.rs
index 12468750923..84f34c0039a 100644
--- a/src/librustc_typeck/check/place_op.rs
+++ b/src/librustc_typeck/check/place_op.rs
@@ -200,13 +200,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         // Gather up expressions we want to munge.
         let mut exprs = vec![expr];
 
-        loop {
-            match exprs.last().unwrap().kind {
-                hir::ExprKind::Field(ref expr, _)
-                | hir::ExprKind::Index(ref expr, _)
-                | hir::ExprKind::Unary(hir::UnOp::UnDeref, ref expr) => exprs.push(&expr),
-                _ => break,
-            }
+        while let hir::ExprKind::Field(ref expr, _)
+        | hir::ExprKind::Index(ref expr, _)
+        | hir::ExprKind::Unary(hir::UnOp::UnDeref, ref expr) = exprs.last().unwrap().kind
+        {
+            exprs.push(&expr);
         }
 
         debug!("convert_place_derefs_to_mutable: exprs={:?}", exprs);