Use vec::truncate for vec::retain
This commit is contained in:
parent
3d54187890
commit
e368b16f82
1 changed files with 2 additions and 3 deletions
|
@ -895,9 +895,8 @@ pub fn retain<T>(v: &mut ~[T], f: pure fn(t: &T) -> bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while deleted > 0 {
|
if deleted > 0 {
|
||||||
v.pop();
|
v.truncate(len - deleted);
|
||||||
deleted -= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue