Use drain() instead of reallocating.
This commit is contained in:
parent
e1db863691
commit
064c2e08dc
1 changed files with 2 additions and 1 deletions
|
|
@ -177,7 +177,8 @@ impl<'a, T: Read + Write + 'a> Handle<'a, T> {
|
||||||
if rest.is_empty() {
|
if rest.is_empty() {
|
||||||
v.clear();
|
v.clear();
|
||||||
} else if rest.len() != v.len() {
|
} else if rest.len() != v.len() {
|
||||||
v = rest.into();
|
let used = v.len() - rest.len();
|
||||||
|
v.drain(0..used);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue