From 7a55800ea406890501882d112badcdc44589e739 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/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 +++--- 4 files changed, 12 insertions(+), 14 deletions(-) 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 }