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

fix(CI): rust 1.83 clippy + wasm-bindgen #1354

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
54 changes: 28 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ diesel-wasm-sqlite = "0.0.1"
diesel_migrations = { version = "2.2", default-features = false }
parking_lot = "0.12.3"
wasm-bindgen-futures = "0.4"
wasm-bindgen = "=0.2.95"
wasm-bindgen-test = "0.3.45"
wasm-bindgen = "=0.2.97"
wasm-bindgen-test = "0.3.47"
gloo-timers = "0.3"
web-sys = "0.3"
js-sys = "0.3"
Expand Down
7 changes: 6 additions & 1 deletion bindings_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ use logger::FfiLogger;
pub use mls::*;
use std::error::Error;

uniffi::include_scaffolding!("xmtpv3");
pub use ffi::*;
#[allow(clippy::all)]
mod ffi {
use super::*;
uniffi::include_scaffolding!("xmtpv3");
}

#[derive(uniffi::Error, thiserror::Error, Debug)]
#[uniffi(flat_error)]
Expand Down
2 changes: 1 addition & 1 deletion xmtp_cryptography/src/basic_credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl Signer for XmtpInstallationCredential {
}

// The signer here must maintain compatability with `SignatureKeyPair`
impl<'a> Signer for &'a XmtpInstallationCredential {
impl Signer for &XmtpInstallationCredential {
fn sign(&self, payload: &[u8]) -> Result<Vec<u8>, signatures::SignerError> {
SignatureKeyPair::from(*self).sign(payload)
}
Expand Down
15 changes: 10 additions & 5 deletions xmtp_debug/src/app/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ impl<C: speedy::Context, const N: usize> Writable<C> for NetworkKey<N> {
}

impl<const N: usize> redb::Value for NetworkKey<N> {
type SelfType<'a> = NetworkKey<N>
type SelfType<'a>
= NetworkKey<N>
where
Self: 'a;

type AsBytes<'a> = Vec<u8> // TODO: It _has_ be possible to make this a const [u8; N] somehow.
type AsBytes<'a>
= Vec<u8>
// TODO: It _has_ be possible to make this a const [u8; N] somehow.
// We're not allowed to use `size_of::<NetworkKey<N>>()` yet, even though size_of and N are
// both constant
where
Expand Down Expand Up @@ -197,7 +200,7 @@ pub struct KeyValueStore<'db, Storage> {
store: Storage,
}

impl<'db, Storage> KeyValueStore<'db, Storage> {
impl<Storage> KeyValueStore<'_, Storage> {
fn apply_write(&self, op: impl FnOnce(&WriteTransaction) -> Result<()>) -> Result<()> {
use DatabaseOrTransaction::*;
match self.db {
Expand Down Expand Up @@ -376,11 +379,13 @@ pub struct Metadata {
}

impl redb::Value for Metadata {
type SelfType<'a> = Metadata
type SelfType<'a>
= Metadata
where
Self: 'a;

type AsBytes<'a> = [u8; size_of::<Metadata>()]
type AsBytes<'a>
= [u8; size_of::<Metadata>()]
where
Self: 'a;

Expand Down
2 changes: 1 addition & 1 deletion xmtp_debug/src/app/store/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl super::DeriveKey<GroupKey> for Group {
}
}

impl<'a> super::DeriveKey<GroupKey> for &'a Group {
impl super::DeriveKey<GroupKey> for &Group {
fn key(&self, network: u64) -> GroupKey {
GroupKey {
network,
Expand Down
2 changes: 1 addition & 1 deletion xmtp_debug/src/app/store/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl super::DeriveKey<IdentityKey> for Identity {
}
}

impl<'a> super::DeriveKey<IdentityKey> for &'a Identity {
impl super::DeriveKey<IdentityKey> for &Identity {
fn key(&self, network: u64) -> IdentityKey {
IdentityKey {
network,
Expand Down
2 changes: 1 addition & 1 deletion xmtp_debug/src/app/store/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl super::DeriveKey<MetaKey> for Metadata {
}
}

impl<'a> super::DeriveKey<MetaKey> for &'a Metadata {
impl super::DeriveKey<MetaKey> for &Metadata {
fn key(&self, network: u64) -> MetaKey {
MetaKey {
network,
Expand Down
12 changes: 8 additions & 4 deletions xmtp_debug/src/app/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,13 @@ struct ForeignIdentity {
}

impl redb::Value for Identity {
type SelfType<'a> = Identity
type SelfType<'a>
= Identity
where
Self: 'a;

type AsBytes<'a> = [u8; size_of::<Identity>()]
type AsBytes<'a>
= [u8; size_of::<Identity>()]
where
Self: 'a;

Expand Down Expand Up @@ -184,11 +186,13 @@ pub struct Group {
}

impl redb::Value for Group {
type SelfType<'a> = Group
type SelfType<'a>
= Group
where
Self: 'a;

type AsBytes<'a> = Vec<u8>
type AsBytes<'a>
= Vec<u8>
where
Self: 'a;

Expand Down
1 change: 0 additions & 1 deletion xmtp_mls/src/groups/group_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ impl TryFrom<&Extensions> for GroupMetadata {
* *DM*: A conversation between 2 members with simplified permissions
* *Sync*: A conversation between all the devices of a single member with simplified permissions
*/

impl From<ConversationType> for ConversationTypeProto {
fn from(value: ConversationType) -> Self {
match value {
Expand Down
4 changes: 2 additions & 2 deletions xmtp_mls/src/groups/group_mutable_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ impl TryFrom<GroupMutableMetadataProto> for GroupMutableMetadata {
fn try_from(value: GroupMutableMetadataProto) -> Result<Self, Self::Error> {
let admin_list = value
.admin_list
.ok_or_else(|| GroupMutableMetadataError::MissingMetadataField)?
.ok_or(GroupMutableMetadataError::MissingMetadataField)?
.inbox_ids;

let super_admin_list = value
.super_admin_list
.ok_or_else(|| GroupMutableMetadataError::MissingMetadataField)?
.ok_or(GroupMutableMetadataError::MissingMetadataField)?
.inbox_ids;

Ok(Self::new(
Expand Down
4 changes: 2 additions & 2 deletions xmtp_mls/src/groups/mls_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,10 +1353,10 @@ fn extract_message_sender(
}

let basic_credential = BasicCredential::try_from(decrypted_message.credential().clone())?;
return Err(GroupMessageProcessingError::InvalidSender {
Err(GroupMessageProcessingError::InvalidSender {
message_time_ns: message_created_ns,
credential: basic_credential.identity().to_vec(),
});
})
}

// Takes UpdateGroupMembershipIntentData and applies it to the openmls group
Expand Down
12 changes: 6 additions & 6 deletions xmtp_mls/src/groups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2419,7 +2419,7 @@ pub(crate) mod tests {
.attributes
.get(&MetadataField::GroupName.to_string())
.unwrap()
.eq(""));
.is_empty());

// Add bola to the group
amal_group
Expand All @@ -2441,7 +2441,7 @@ pub(crate) mod tests {
.attributes
.get(&MetadataField::GroupName.to_string())
.unwrap()
.eq(""));
.is_empty());

// Update group name
amal_group
Expand Down Expand Up @@ -2510,7 +2510,7 @@ pub(crate) mod tests {
.attributes
.get(&MetadataField::GroupImageUrlSquare.to_string())
.unwrap()
.eq(""));
.is_empty());

// Update group name
amal_group
Expand Down Expand Up @@ -2549,7 +2549,7 @@ pub(crate) mod tests {
.attributes
.get(&MetadataField::GroupPinnedFrameUrl.to_string())
.unwrap()
.eq(""));
.is_empty());

// Update group name
amal_group
Expand Down Expand Up @@ -2590,7 +2590,7 @@ pub(crate) mod tests {
.attributes
.get(&MetadataField::GroupName.to_string())
.unwrap()
.eq(""));
.is_empty());

// Add bola to the group
amal_group
Expand All @@ -2611,7 +2611,7 @@ pub(crate) mod tests {
.attributes
.get(&MetadataField::GroupName.to_string())
.unwrap()
.eq(""));
.is_empty());

// Update group name
amal_group
Expand Down
Loading
Loading