From e218ce8f9b2f5cba5c8754c5d3e243482d8b71de Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sun, 13 Oct 2024 23:17:08 +0200 Subject: [PATCH] Remove unnecessary Send + Sync bounds --- eyeball-im-util/src/vector/traits.rs | 14 +++++++------- eyeball-im/src/vector.rs | 6 +++--- eyeball-im/src/vector/entry.rs | 4 ++-- eyeball-im/src/vector/subscriber.rs | 10 ++++------ eyeball-im/src/vector/transaction.rs | 6 +++--- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/eyeball-im-util/src/vector/traits.rs b/eyeball-im-util/src/vector/traits.rs index e24c705..5d217e0 100644 --- a/eyeball-im-util/src/vector/traits.rs +++ b/eyeball-im-util/src/vector/traits.rs @@ -22,18 +22,18 @@ pub trait VectorDiffContainer: { /// The element type of the [`Vector`][imbl::Vector] that diffs are being /// handled for. - type Element: Clone + Send + Sync + 'static; + type Element: Clone + 'static; #[doc(hidden)] type Family: VectorDiffContainerFamily = Self>; } -impl VectorDiffContainer for VectorDiff { +impl VectorDiffContainer for VectorDiff { type Element = T; type Family = VectorDiffFamily; } -impl VectorDiffContainer for Vec> { +impl VectorDiffContainer for Vec> { type Element = T; type Family = VecVectorDiffFamily; } @@ -69,7 +69,7 @@ pub trait VectorObserver: Sized { fn into_parts(self) -> (Vector, Self::Stream); } -impl VectorObserver for VectorSubscriber { +impl VectorObserver for VectorSubscriber { type Stream = VectorSubscriberStream; fn into_parts(self) -> (Vector, Self::Stream) { @@ -77,7 +77,7 @@ impl VectorObserver for VectorSubscriber } } -impl VectorObserver for BatchedVectorSubscriber { +impl VectorObserver for BatchedVectorSubscriber { type Stream = VectorSubscriberBatchedStream; fn into_parts(self) -> (Vector, Self::Stream) { @@ -102,7 +102,7 @@ where /// See that trait for which types implement this. pub trait VectorObserverExt: VectorObserver where - T: Clone + Send + Sync + 'static, + T: Clone + 'static, ::Item: VectorDiffContainer, { /// Filter the vector's values with the given function. @@ -197,7 +197,7 @@ where impl VectorObserverExt for O where - T: Clone + Send + Sync + 'static, + T: Clone + 'static, O: VectorObserver, ::Item: VectorDiffContainer, { diff --git a/eyeball-im/src/vector.rs b/eyeball-im/src/vector.rs index 27f3598..66778c6 100644 --- a/eyeball-im/src/vector.rs +++ b/eyeball-im/src/vector.rs @@ -22,7 +22,7 @@ pub struct ObservableVector { sender: Sender>, } -impl ObservableVector { +impl ObservableVector { /// Create a new `ObservableVector`. /// /// As of the time of writing, this is equivalent to @@ -290,7 +290,7 @@ impl ObservableVector { } } -impl Default for ObservableVector { +impl Default for ObservableVector { fn default() -> Self { Self::new() } @@ -315,7 +315,7 @@ impl ops::Deref for ObservableVector { } } -impl From> for ObservableVector { +impl From> for ObservableVector { fn from(values: Vector) -> Self { let mut this = Self::new(); this.append(values); diff --git a/eyeball-im/src/vector/entry.rs b/eyeball-im/src/vector/entry.rs index cf6b117..2cae284 100644 --- a/eyeball-im/src/vector/entry.rs +++ b/eyeball-im/src/vector/entry.rs @@ -10,7 +10,7 @@ pub struct ObservableVectorEntry<'a, T> { impl<'a, T> ObservableVectorEntry<'a, T> where - T: Clone + Send + Sync + 'static, + T: Clone + 'static, { pub(super) fn new(inner: &'a mut ObservableVector, index: usize) -> Self { Self { inner, index: EntryIndex::Owned(index) } @@ -115,7 +115,7 @@ pub struct ObservableVectorEntries<'a, T> { impl<'a, T> ObservableVectorEntries<'a, T> where - T: Clone + Send + Sync + 'static, + T: Clone + 'static, { pub(super) fn new(inner: &'a mut ObservableVector) -> Self { Self { inner, index: 0 } diff --git a/eyeball-im/src/vector/subscriber.rs b/eyeball-im/src/vector/subscriber.rs index 1cdb995..b2d69cf 100644 --- a/eyeball-im/src/vector/subscriber.rs +++ b/eyeball-im/src/vector/subscriber.rs @@ -27,7 +27,7 @@ pub struct VectorSubscriber { rx: Receiver>, } -impl VectorSubscriber { +impl VectorSubscriber { pub(super) fn new(items: Vector, rx: Receiver>) -> Self { Self { values: items, rx } } @@ -99,7 +99,7 @@ enum VectorSubscriberStreamState { // Not clear why this explicit impl is needed, but it's not unsafe so it is fine impl Unpin for VectorSubscriberStreamState {} -impl Stream for VectorSubscriberStream { +impl Stream for VectorSubscriberStream { type Item = VectorDiff; fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { @@ -170,7 +170,7 @@ impl VectorSubscriberBatchedStream { } } -impl Stream for VectorSubscriberBatchedStream { +impl Stream for VectorSubscriberBatchedStream { type Item = Vec>; fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { @@ -212,9 +212,7 @@ impl Stream for VectorSubscriberBatchedStream< } } -fn handle_lag( - rx: &mut Receiver>, -) -> Option> { +fn handle_lag(rx: &mut Receiver>) -> Option> { let mut msg = None; loop { match rx.try_recv() { diff --git a/eyeball-im/src/vector/transaction.rs b/eyeball-im/src/vector/transaction.rs index adc8e9d..7178721 100644 --- a/eyeball-im/src/vector/transaction.rs +++ b/eyeball-im/src/vector/transaction.rs @@ -21,7 +21,7 @@ pub struct ObservableVectorTransaction<'o, T: Clone> { batch: Vec>, } -impl<'o, T: Clone + Send + Sync + 'static> ObservableVectorTransaction<'o, T> { +impl<'o, T: Clone + 'static> ObservableVectorTransaction<'o, T> { pub(super) fn new(inner: &'o mut ObservableVector) -> Self { let values = inner.values.clone(); Self { inner, values, batch: Vec::new() } @@ -316,7 +316,7 @@ pub struct ObservableVectorTransactionEntry<'a, 'o, T: Clone> { impl<'a, 'o, T> ObservableVectorTransactionEntry<'a, 'o, T> where - T: Clone + Send + Sync + 'static, + T: Clone + 'static, { pub(super) fn new(inner: &'a mut ObservableVectorTransaction<'o, T>, index: usize) -> Self { Self { inner, index: EntryIndex::Owned(index) } @@ -397,7 +397,7 @@ pub struct ObservableVectorTransactionEntries<'a, 'o, T: Clone> { impl<'a, 'o, T> ObservableVectorTransactionEntries<'a, 'o, T> where - T: Clone + Send + Sync + 'static, + T: Clone + 'static, { pub(super) fn new(inner: &'a mut ObservableVectorTransaction<'o, T>) -> Self { Self { inner, index: 0 }