Use vec::truncate for vec::retain
Merge pull request #4485 from sanxiyn/use-truncate

Use vec::truncate for vec::retain