removed redundant memcopy
This commit is contained in:
parent
59c0551ff4
commit
fa050246af
@ -15,6 +15,7 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
use std::mem;
|
||||||
use std::f64;
|
use std::f64;
|
||||||
use std::hash::{Hash, Hasher, SipHasher};
|
use std::hash::{Hash, Hasher, SipHasher};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
@ -58,8 +59,8 @@ impl BitVecJournal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn drain(&mut self) -> Vec<(usize, u64)> {
|
pub fn drain(&mut self) -> Vec<(usize, u64)> {
|
||||||
let journal = self.journal.drain().collect::<Vec<usize>>();
|
let journal = mem::replace(&mut self.journal, HashSet::new()).into_iter();
|
||||||
journal.iter().map(|idx| (*idx, self.elems[*idx])).collect::<Vec<(usize, u64)>>()
|
journal.map(|idx| (idx, self.elems[idx])).collect::<Vec<(usize, u64)>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn how_full(&self) -> f64 {
|
pub fn how_full(&self) -> f64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user