Remove single use variables
This commit is contained in:
parent
5998c2e9ad
commit
99a3d64673
1 changed files with 2 additions and 5 deletions
|
@ -412,8 +412,7 @@ impl<'tcx> Body<'tcx> {
|
||||||
/// Returns an iterator over all function arguments.
|
/// Returns an iterator over all function arguments.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator {
|
pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator {
|
||||||
let arg_count = self.arg_count;
|
(1..self.arg_count + 1).map(Local::new)
|
||||||
(1..arg_count + 1).map(Local::new)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an iterator over all user-defined variables and compiler-generated temporaries (all
|
/// Returns an iterator over all user-defined variables and compiler-generated temporaries (all
|
||||||
|
@ -422,9 +421,7 @@ impl<'tcx> Body<'tcx> {
|
||||||
pub fn vars_and_temps_iter(
|
pub fn vars_and_temps_iter(
|
||||||
&self,
|
&self,
|
||||||
) -> impl DoubleEndedIterator<Item = Local> + ExactSizeIterator {
|
) -> impl DoubleEndedIterator<Item = Local> + ExactSizeIterator {
|
||||||
let arg_count = self.arg_count;
|
(self.arg_count + 1..self.local_decls.len()).map(Local::new)
|
||||||
let local_count = self.local_decls.len();
|
|
||||||
(arg_count + 1..local_count).map(Local::new)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
|
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue