Merge pull request #4485 from sanxiyn/use-truncate
Use vec::truncate for vec::retain
This commit is contained in:
commit
0ca369e9dc
@ -895,9 +895,8 @@ pub fn retain<T>(v: &mut ~[T], f: pure fn(t: &T) -> bool) {
|
||||
}
|
||||
}
|
||||
|
||||
while deleted > 0 {
|
||||
v.pop();
|
||||
deleted -= 1;
|
||||
if deleted > 0 {
|
||||
v.truncate(len - deleted);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user