about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-03-01 20:21:09 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2020-03-01 21:17:48 +0100
commit22339c340615d6c8ad6a05bf4ff339113c19d968 (patch)
tree9a9ff960a680a17039eb704c264a80db6510a6a6 /src/librustc
parent03aecda83ad54098266e9e44cc04e0b37c3cf47a (diff)
downloadrust-22339c340615d6c8ad6a05bf4ff339113c19d968.tar.gz
rust-22339c340615d6c8ad6a05bf4ff339113c19d968.zip
use for (idx, item) in iter.enumerate() instead of manually counting loop iterations by variables
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/ty/layout.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs
index e10c0241435..641f904ae69 100644
--- a/src/librustc/ty/layout.rs
+++ b/src/librustc/ty/layout.rs
@@ -1382,10 +1382,8 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
 
         // Write down the order of our locals that will be promoted to the prefix.
         {
-            let mut idx = 0u32;
-            for local in ineligible_locals.iter() {
-                assignments[local] = Ineligible(Some(idx));
-                idx += 1;
+            for (idx, local) in ineligible_locals.iter().enumerate() {
+                assignments[local] = Ineligible(Some(idx as u32));
             }
         }
         debug!("generator saved local assignments: {:?}", assignments);