Avoid intermediate allocation
This commit is contained in:
parent
c7420ddaaa
commit
7e0fa71532
1 changed files with 1 additions and 1 deletions
|
@ -223,7 +223,7 @@ impl Substs {
|
|||
}
|
||||
|
||||
pub fn prefix(&self, n: usize) -> Substs {
|
||||
Substs(self.0.iter().cloned().take(n).collect::<Vec<_>>().into())
|
||||
Substs(self.0[..std::cmp::min(self.0.len(), n)].into())
|
||||
}
|
||||
|
||||
pub fn walk(&self, f: &mut impl FnMut(&Ty)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue