Skip to content

Commit

Permalink
self by ref
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed Dec 7, 2023
1 parent 49ff22f commit a028e9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions xmtp_cryptography/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ pub fn h160addr_to_string(bytes: H160) -> String {
/// Check if an string is a valid ethereum address (valid hex and length 20).
pub fn is_valid_ethereum_address<S: AsRef<str>>(address: S) -> bool {
let address = address.as_ref();
let address = address.strip_prefix(&"0x").unwrap_or(&address);
let address = address.strip_prefix("0x").unwrap_or(address);

if address.len() != 40 {
return false;
}

for char in address.chars() {
if !char.is_digit(16) {
if !char.is_ascii_hexdigit() {
return false;
}
}
Expand Down
8 changes: 4 additions & 4 deletions xmtp_mls/src/groups/intents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ impl AddMembersIntentData {
Self { account_addresses }
}

pub(crate) fn to_bytes(self) -> Result<Vec<u8>, IntentError> {
pub(crate) fn to_bytes(&self) -> Result<Vec<u8>, IntentError> {
let mut buf = Vec::new();
AddMembersData {
version: Some(AddMembersVersion::V1(AddMembersV1 {
account_addresses: self.account_addresses,
account_addresses: self.account_addresses.clone(),
})),
}
.encode(&mut buf)
Expand Down Expand Up @@ -116,12 +116,12 @@ impl RemoveMembersIntentData {
Self { account_addresses }
}

pub(crate) fn to_bytes(self) -> Vec<u8> {
pub(crate) fn to_bytes(&self) -> Vec<u8> {
let mut buf = Vec::new();

RemoveMembersData {
version: Some(RemoveMembersVersion::V1(RemoveMembersV1 {
account_addresses: self.account_addresses,
account_addresses: self.account_addresses.clone(),
})),
}
.encode(&mut buf)
Expand Down

0 comments on commit a028e9a

Please sign in to comment.