Skip to content

Commit 99a3d64

Browse files
committed
Remove single use variables
1 parent 5998c2e commit 99a3d64

File tree

1 file changed

+2
-5
lines changed
  • compiler/rustc_middle/src/mir

1 file changed

+2
-5
lines changed

Diff for: compiler/rustc_middle/src/mir/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,7 @@ impl<'tcx> Body<'tcx> {
412412
/// Returns an iterator over all function arguments.
413413
#[inline]
414414
pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator {
415-
let arg_count = self.arg_count;
416-
(1..arg_count + 1).map(Local::new)
415+
(1..self.arg_count + 1).map(Local::new)
417416
}
418417

419418
/// Returns an iterator over all user-defined variables and compiler-generated temporaries (all
@@ -422,9 +421,7 @@ impl<'tcx> Body<'tcx> {
422421
pub fn vars_and_temps_iter(
423422
&self,
424423
) -> impl DoubleEndedIterator<Item = Local> + ExactSizeIterator {
425-
let arg_count = self.arg_count;
426-
let local_count = self.local_decls.len();
427-
(arg_count + 1..local_count).map(Local::new)
424+
(self.arg_count + 1..self.local_decls.len()).map(Local::new)
428425
}
429426

430427
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids

0 commit comments

Comments
 (0)