Skip to content

Commit d507836

Browse files
committed
Make PartialEq implementation for DequeInner and HistoryBufInner generic over the storage of the RHS
1 parent 891c019 commit d507836

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

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

1010
- Added `from_bytes_truncating_at_nul` to `CString`
1111
- Added missing `?Sized` bounds in `PartialEq` implementations
12+
- Make `PartialEq` implementation for `DequeInner` and `HistoryBufInner` generic over the storage of the RHS
1213

1314
## [v0.9.2] 2025-11-12
1415

src/deque.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,8 +1164,12 @@ where
11641164
}
11651165
}
11661166

1167-
impl<T: PartialEq, S: VecStorage<T> + ?Sized> PartialEq for DequeInner<T, S> {
1168-
fn eq(&self, other: &Self) -> bool {
1167+
impl<T: PartialEq, S1, S2> PartialEq<DequeInner<T, S2>> for DequeInner<T, S1>
1168+
where
1169+
S1: VecStorage<T> + ?Sized,
1170+
S2: VecStorage<T> + ?Sized,
1171+
{
1172+
fn eq(&self, other: &DequeInner<T, S2>) -> bool {
11691173
if self.storage_len() != other.storage_len() {
11701174
return false;
11711175
}

src/history_buf.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,11 +610,13 @@ impl<T, const N: usize> Default for HistoryBuf<T, N> {
610610
}
611611
}
612612

613-
impl<T, S: HistoryBufStorage<T> + ?Sized> PartialEq for HistoryBufInner<T, S>
613+
impl<T, S1, S2> PartialEq<HistoryBufInner<T, S2>> for HistoryBufInner<T, S1>
614614
where
615615
T: PartialEq,
616+
S1: HistoryBufStorage<T> + ?Sized,
617+
S2: HistoryBufStorage<T> + ?Sized,
616618
{
617-
fn eq(&self, other: &Self) -> bool {
619+
fn eq(&self, other: &HistoryBufInner<T, S2>) -> bool {
618620
self.oldest_ordered().eq(other.oldest_ordered())
619621
}
620622
}

0 commit comments

Comments
 (0)