From 99a3d646734c3aa7ff2564637e52e041e311c288 Mon Sep 17 00:00:00 2001 From: Paul Trojahn Date: Tue, 31 Aug 2021 15:53:50 +0200 Subject: [PATCH] Remove single use variables --- compiler/rustc_middle/src/mir/mod.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index b66995afc6d..d0a144a2d98 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -412,8 +412,7 @@ pub fn mut_vars_and_args_iter<'a>(&'a self) -> impl Iterator + 'a /// Returns an iterator over all function arguments. #[inline] pub fn args_iter(&self) -> impl Iterator + ExactSizeIterator { - let arg_count = self.arg_count; - (1..arg_count + 1).map(Local::new) + (1..self.arg_count + 1).map(Local::new) } /// Returns an iterator over all user-defined variables and compiler-generated temporaries (all @@ -422,9 +421,7 @@ pub fn args_iter(&self) -> impl Iterator + ExactSizeIterator { pub fn vars_and_temps_iter( &self, ) -> impl DoubleEndedIterator + ExactSizeIterator { - let arg_count = self.arg_count; - let local_count = self.local_decls.len(); - (arg_count + 1..local_count).map(Local::new) + (self.arg_count + 1..self.local_decls.len()).map(Local::new) } /// Changes a statement to a nop. This is both faster than deleting instructions and avoids