From 22339c340615d6c8ad6a05bf4ff339113c19d968 Mon Sep 17 00:00:00 2001 From: Matthias Krüger Date: Sun, 1 Mar 2020 20:21:09 +0100 Subject: use for (idx, item) in iter.enumerate() instead of manually counting loop iterations by variables --- src/librustc/ty/layout.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/librustc') 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); -- cgit 1.4.1-3-g733a5