Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint fix rust 1.8.4 #1482

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions xmtp_mls/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ where
}

/// Get the [`AssociationState`] for each `inbox_id`
pub async fn inbox_addresses<'a>(
pub async fn inbox_addresses(
&self,
refresh_from_network: bool,
inbox_ids: Vec<InboxIdRef<'a>>,
inbox_ids: Vec<InboxIdRef<'_>>,
) -> Result<Vec<AssociationState>, ClientError> {
let conn = self.store().conn()?;
if refresh_from_network {
Expand Down
5 changes: 3 additions & 2 deletions xmtp_mls/src/groups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1245,13 +1245,14 @@ impl<ScopedClient: ScopedGroupClient> MlsGroup<ScopedClient> {
provider: &XmtpOpenMlsProvider,
state: ConsentState,
) -> Result<(), GroupError> {

let consent_record = StoredConsentRecord::new(
ConsentType::ConversationId,
state,
hex::encode(self.group_id.clone()),
);
provider.conn_ref().insert_or_replace_consent_records(&[consent_record.clone()])?;
provider
.conn_ref()
.insert_or_replace_consent_records(&[consent_record.clone()])?;

if self.client.history_sync_url().is_some() {
// Dispatch an update event so it can be synced across devices
Expand Down
32 changes: 16 additions & 16 deletions xmtp_mls/src/groups/scoped_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ pub trait LocalScopedGroupClient: Send + Sync + Sized {
installation_ids: Vec<Vec<u8>>,
) -> Result<Vec<VerifiedKeyPackageV2>, ClientError>;

async fn get_association_state<'a>(
async fn get_association_state(
&self,
conn: &DbConnection,
inbox_id: InboxIdRef<'a>,
inbox_id: InboxIdRef<'_>,
to_sequence_id: Option<i64>,
) -> Result<AssociationState, ClientError>;

async fn batch_get_association_state<'a>(
async fn batch_get_association_state(
&self,
conn: &DbConnection,
identifiers: &[(InboxIdRef<'a>, Option<i64>)],
identifiers: &[(InboxIdRef<'_>, Option<i64>)],
) -> Result<Vec<AssociationState>, ClientError>;

async fn query_group_messages(
Expand Down Expand Up @@ -201,10 +201,10 @@ where
.await
}

async fn get_association_state<'a>(
async fn get_association_state(
&self,
conn: &DbConnection,
inbox_id: InboxIdRef<'a>,
inbox_id: InboxIdRef<'_>,
to_sequence_id: Option<i64>,
) -> Result<AssociationState, ClientError> {
crate::Client::<ApiClient, Verifier>::get_association_state(
Expand All @@ -216,10 +216,10 @@ where
.await
}

async fn batch_get_association_state<'a>(
async fn batch_get_association_state(
&self,
conn: &DbConnection,
identifiers: &[(InboxIdRef<'a>, Option<i64>)],
identifiers: &[(InboxIdRef<'_>, Option<i64>)],
) -> Result<Vec<AssociationState>, ClientError> {
crate::Client::<ApiClient, Verifier>::batch_get_association_state(self, conn, identifiers)
.await
Expand Down Expand Up @@ -294,21 +294,21 @@ where
.await
}

async fn get_association_state<'a>(
async fn get_association_state(
&self,
conn: &DbConnection,
inbox_id: InboxIdRef<'a>,
inbox_id: InboxIdRef<'_>,
to_sequence_id: Option<i64>,
) -> Result<AssociationState, ClientError> {
(**self)
.get_association_state(conn, inbox_id, to_sequence_id)
.await
}

async fn batch_get_association_state<'a>(
async fn batch_get_association_state(
&self,
conn: &DbConnection,
identifiers: &[(InboxIdRef<'a>, Option<i64>)],
identifiers: &[(InboxIdRef<'_>, Option<i64>)],
) -> Result<Vec<AssociationState>, ClientError> {
(**self)
.batch_get_association_state(conn, identifiers)
Expand Down Expand Up @@ -384,21 +384,21 @@ where
.await
}

async fn get_association_state<'a>(
async fn get_association_state(
&self,
conn: &DbConnection,
inbox_id: InboxIdRef<'a>,
inbox_id: InboxIdRef<'_>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inbox_id: InboxIdRef<'_>,
inbox_id: InboxIdRef,

Would this work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without the anonymous lifetime it gives a compiler error:

implicit elided lifetime not allowed here
expected lifetime parameterrustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20%5B0%5D?0#file%3A%2F%2F%2FUsers%2Fcameronvoell%2FXMTP%2Flibxmtp%2Fxmtp_mls%2Fsrc%2Fgroups%2Fscoped_client.rs)
scoped_client.rs(390, 29): indicate the anonymous lifetime: `<'_>`

to_sequence_id: Option<i64>,
) -> Result<AssociationState, ClientError> {
(**self)
.get_association_state(conn, inbox_id, to_sequence_id)
.await
}

async fn batch_get_association_state<'a>(
async fn batch_get_association_state(
&self,
conn: &DbConnection,
identifiers: &[(InboxIdRef<'a>, Option<i64>)],
identifiers: &[(InboxIdRef<'_>, Option<i64>)],
) -> Result<Vec<AssociationState>, ClientError> {
(**self)
.batch_get_association_state(conn, identifiers)
Expand Down
2 changes: 1 addition & 1 deletion xmtp_mls/src/groups/validated_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ struct ExpectedDiff {
/// [`GroupMembership`] and the [`GroupMembership`] found in the [`StagedCommit`].
/// This requires loading the Inbox state from the network.
/// Satisfies Rule 2
async fn extract_expected_diff<'diff>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lifetime isn't used

async fn extract_expected_diff(
conn: &DbConnection,
client: impl ScopedGroupClient,
staged_commit: &StagedCommit,
Expand Down
Loading