Skip to content

Commit 0a21a56

Browse files
committed
Fix Clone to preserve ordering, add Changelog entry.
1 parent 340e0ce commit 0a21a56

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313

1414
- [breaking-change] `IndexMap` and `IndexSet` now require that keys implement the `core::hash::Hash`
1515
trait instead of the `hash32::Hash` (v0.2.0) trait
16+
- `HistoryBuffer` implements `Clone` and `PartialEq`.
1617

1718
### Fixed
1819

src/histbuf.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ where
244244
{
245245
fn clone(&self) -> Self {
246246
let mut ret = Self::new();
247-
ret.extend(self.iter().cloned());
247+
for (new, old) in ret.data.iter_mut().zip(self.as_slice()) {
248+
new.write(old.clone());
249+
}
250+
ret.filled = self.filled;
251+
ret.write_at = self.write_at;
248252
ret
249253
}
250254
}

0 commit comments

Comments
 (0)