Skip to content

Commit

Permalink
Rollup merge of rust-lang#88532 - ptrojahn:single_use, r=davidtwco
Browse files Browse the repository at this point in the history
Remove single use variables
  • Loading branch information
GuillaumeGomez authored Sep 2, 2021
2 parents c892775 + 99a3d64 commit 1d1e931
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ impl<'tcx> Body<'tcx> {
/// Returns an iterator over all function arguments.
#[inline]
pub fn args_iter(&self) -> impl Iterator<Item = Local> + 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
Expand All @@ -421,9 +420,7 @@ impl<'tcx> Body<'tcx> {
pub fn vars_and_temps_iter(
&self,
) -> impl DoubleEndedIterator<Item = Local> + 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)
}

#[inline]
Expand Down

0 comments on commit 1d1e931

Please sign in to comment.