From da9f4645bd5264d178271da781793d1169f60b2b Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 29 Jan 2025 16:26:59 -0500 Subject: [PATCH] cleanup --- xmtp_id/src/lib.rs | 8 ++++---- xmtp_mls/src/groups/mls_sync.rs | 12 ++++-------- xmtp_mls/src/groups/scoped_client.rs | 4 ++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/xmtp_id/src/lib.rs b/xmtp_id/src/lib.rs index 6f3509d17..37c64a237 100755 --- a/xmtp_id/src/lib.rs +++ b/xmtp_id/src/lib.rs @@ -40,16 +40,16 @@ pub type InboxId = String; pub type WalletAddress = String; pub trait AsIdRef: Send + Sync { - fn as_ref<'a>(&'a self) -> InboxIdRef<'a>; + fn as_ref(&'_ self) -> InboxIdRef<'_>; } impl AsIdRef for InboxId { - fn as_ref<'a>(&'a self) -> InboxIdRef<'a> { - &*self + fn as_ref(&self) -> InboxIdRef<'_> { + self } } impl AsIdRef for InboxIdRef<'_> { - fn as_ref<'a>(&'a self) -> InboxIdRef<'a> { + fn as_ref(&self) -> InboxIdRef<'_> { self } } diff --git a/xmtp_mls/src/groups/mls_sync.rs b/xmtp_mls/src/groups/mls_sync.rs index cb4b5935f..49c70ff6e 100644 --- a/xmtp_mls/src/groups/mls_sync.rs +++ b/xmtp_mls/src/groups/mls_sync.rs @@ -583,8 +583,9 @@ where mls_group, ) .await?; - // We don't care about the validated commit because we need to recreate it below anyway. - // This is to fetch the missing identity updates. + // We don't care about the validated commit because we need to + // recreate it below after re-processing the message anyway. + // This is to fetch the missing identity updates so the eager revalidation below doesn't fail. let _ = ValidatedCommit::from_staged_commit_with_identity_update_attempt( &self.client, provider.conn_ref(), @@ -601,21 +602,16 @@ where provider.transaction(|provider| { let processed_message = mls_group.process_message(provider, message)?; - let mut validated_commit = None; if let ProcessedMessageContent::StagedCommitMessage(staged_commit) = processed_message.content() { - let Some(expected_diff) = expected_diff else { - unreachable!(); - }; - validated_commit = Some(ValidatedCommit::from_staged_commit( provider.conn_ref(), staged_commit, mls_group, - &expected_diff, + &expected_diff.expect("Should be cached from above."), )?); } diff --git a/xmtp_mls/src/groups/scoped_client.rs b/xmtp_mls/src/groups/scoped_client.rs index 57c249474..f5d8d0ee3 100644 --- a/xmtp_mls/src/groups/scoped_client.rs +++ b/xmtp_mls/src/groups/scoped_client.rs @@ -140,10 +140,10 @@ pub trait ScopedGroupClient: Sized { to_sequence_id: Option, ) -> Result; - async fn batch_get_association_state<'a>( + async fn batch_get_association_state( &self, conn: &DbConnection, - identifiers: &[(InboxIdRef<'a>, Option)], + identifiers: &[(impl AsIdRef, Option)], ) -> Result, ClientError>; async fn query_group_messages(