Skip to content
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
5 changes: 4 additions & 1 deletion bindings/matrix-sdk-ffi/src/room_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ pub enum RoomListError {
InvalidRoomId { error: String },
#[error("Event cache ran into an error: {error}")]
EventCache { error: String },
#[error("The requested room doesn't match the membership requirements {expected:?}, observed {actual:?}")]
#[error(
"The requested room doesn't match the membership requirements {expected:?}, \
observed {actual:?}"
)]
IncorrectRoomMembership { expected: Vec<Membership>, actual: Membership },
}

Expand Down
5 changes: 4 additions & 1 deletion bindings/matrix-sdk-ffi/src/session_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ impl SessionVerificationController {
if sender != self.user_identity.user_id() {
if let Some(status) = self.encryption.cross_signing_status().await {
if !status.is_complete() {
warn!("Cannot verify other users until our own device's cross-signing status is complete: {status:?}");
warn!(
"Cannot verify other users until our own device's cross-signing status \
is complete: {status:?}"
);
return;
}
}
Expand Down
5 changes: 4 additions & 1 deletion bindings/matrix-sdk-ffi/src/timeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,10 @@ impl Timeline {
let event_id = match event_or_transaction_id {
EventOrTransactionId::EventId { event_id } => EventId::parse(event_id)?,
EventOrTransactionId::TransactionId { .. } => {
warn!("trying to apply an edit to a local echo that doesn't exist in this timeline, aborting");
warn!(
"trying to apply an edit to a local echo that doesn't exist \
in this timeline, aborting"
);
return Ok(());
}
};
Expand Down
12 changes: 9 additions & 3 deletions bindings/matrix-sdk-ffi/src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,15 @@ mod tests {
cap_assert("org.matrix.msc2762.receive.event:org.matrix.rageshake_request");
cap_assert("org.matrix.msc2762.receive.event:io.element.call.encryption_keys");
cap_assert("org.matrix.msc2762.receive.state_event:m.room.create");
cap_assert("org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#@my_user:my_domain.org");
cap_assert("org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#@my_user:my_domain.org_ABCDEFGHI");
cap_assert("org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#_@my_user:my_domain.org_ABCDEFGHI");
cap_assert(
"org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#@my_user:my_domain.org",
);
cap_assert(
"org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#@my_user:my_domain.org_ABCDEFGHI",
);
cap_assert(
"org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#_@my_user:my_domain.org_ABCDEFGHI",
);
cap_assert("org.matrix.msc2762.send.event:org.matrix.rageshake_request");
cap_assert("org.matrix.msc2762.send.event:io.element.call.encryption_keys");
}
Expand Down
7 changes: 4 additions & 3 deletions crates/matrix-sdk-base/src/latest_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,10 @@ impl<'de> Deserialize<'de> for LatestEvent {
Err(err) => variant_errors.push(err),
}

Err(serde::de::Error::custom(
format!("data did not match any variant of serialized LatestEvent (using serde_json). Observed errors: {variant_errors:?}")
))
Err(serde::de::Error::custom(format!(
"data did not match any variant of serialized LatestEvent (using serde_json). \
Observed errors: {variant_errors:?}"
)))
}
}

Expand Down
6 changes: 5 additions & 1 deletion crates/matrix-sdk-base/src/room/knock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ impl Room {
if event.content.membership == MembershipState::Knock {
event_to_user_ids.push((event.event_id, event.state_key))
} else {
warn!("Could not mark knock event as seen: event {} for user {} is not in Knock membership state.", event.event_id, event.state_key);
warn!(
"Could not mark knock event as seen: event {} for user {} \
is not in Knock membership state.",
event.event_id, event.state_key
);
}
}
_ => warn!(
Expand Down
11 changes: 8 additions & 3 deletions crates/matrix-sdk-common/src/deserialized_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ const VERIFICATION_VIOLATION: &str =
"Encrypted by a previously-verified user who is no longer verified.";
const UNSIGNED_DEVICE: &str = "Encrypted by a device not verified by its owner.";
const UNKNOWN_DEVICE: &str = "Encrypted by an unknown or deleted device.";
const MISMATCHED_SENDER: &str =
"The sender of the event does not match the owner of the device that created the Megolm session.";
const MISMATCHED_SENDER: &str = "\
The sender of the event does not match the owner of the device \
that created the Megolm session.";
pub const SENT_IN_CLEAR: &str = "Not encrypted.";

/// Represents the state of verification for a decrypted message sent by a
Expand Down Expand Up @@ -588,7 +589,11 @@ impl TimelineEvent {
match latest_event.get_field::<MessageLikeEventType>("type") {
Ok(None) => {
let event_id = latest_event.get_field::<OwnedEventId>("event_id").ok().flatten();
warn!(?event_id, "couldn't deserialize bundled latest thread event: missing `type` field in bundled latest thread event");
warn!(
?event_id,
"couldn't deserialize bundled latest thread event: missing `type` field \
in bundled latest thread event"
);
None
}

Expand Down
11 changes: 7 additions & 4 deletions crates/matrix-sdk-common/src/linked_chunk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl<const CAP: usize, Item, Gap> LinkedChunk<CAP, Item, Gap> {

let chunk = match &mut chunk.content {
ChunkContent::Gap(..) => {
return Err(Error::ChunkIsAGap { identifier: chunk_identifier })
return Err(Error::ChunkIsAGap { identifier: chunk_identifier });
}

ChunkContent::Items(current_items) => {
Expand Down Expand Up @@ -574,7 +574,7 @@ impl<const CAP: usize, Item, Gap> LinkedChunk<CAP, Item, Gap> {

let can_unlink_chunk = match &mut chunk.content {
ChunkContent::Gap(..) => {
return Err(Error::ChunkIsAGap { identifier: chunk_identifier })
return Err(Error::ChunkIsAGap { identifier: chunk_identifier });
}

ChunkContent::Items(current_items) => {
Expand Down Expand Up @@ -644,7 +644,7 @@ impl<const CAP: usize, Item, Gap> LinkedChunk<CAP, Item, Gap> {

match &mut chunk.content {
ChunkContent::Gap(..) => {
return Err(Error::ChunkIsAGap { identifier: chunk_identifier })
return Err(Error::ChunkIsAGap { identifier: chunk_identifier });
}

ChunkContent::Items(current_items) => {
Expand Down Expand Up @@ -1158,7 +1158,10 @@ impl ChunkIdentifierGenerator {
// Check for overflows.
// unlikely — TODO: call `std::intrinsics::unlikely` once it's stable.
if previous == u64::MAX {
panic!("No more chunk identifiers available. Congrats, you did it. 2^64 identifiers have been consumed.")
panic!(
"No more chunk identifiers available. Congrats, you did it. \
2^64 identifiers have been consumed."
)
}

ChunkIdentifier(previous + 1)
Expand Down
4 changes: 3 additions & 1 deletion crates/matrix-sdk-crypto/src/identities/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,9 @@ impl IdentityManager {
{
Some((master_key, self_signing))
} else {
warn!("A user identity didn't contain a self signing pubkey or the key was invalid");
warn!(
"A user identity didn't contain a self signing pubkey or the key was invalid"
);
None
}
}
Expand Down
24 changes: 12 additions & 12 deletions crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,18 +706,18 @@ mod tests {
// This export usse a more efficient serialization format for bytes. This was
// exported when the `KnownSenderData` master_key was serialized as an byte
// array instead of a base64 encoded string.
const SERIALIZED_B64: &str =
"iaZwaWNrbGWEr2luaXRpYWxfcmF0Y2hldIKlaW5uZXLcAIABYMzfSnBRzMlPKF1uKjYbzLtkzNJ4RcylzN0HzP\
9DzON1Tm05zO7M2MzFQsy9Acz9zPnMqDvM4syQzNrMzxF5KzbM4sy9zPUbBWfM7m4/zJzM18zDzMESKgfMkE7M\
yszIHszqWjYyQURbzKTMkx7M58zANsy+AGPM2A8tbcyFYczge8ykzMFdbVxJMMyAzN8azJEXGsy8zPJazMMaP8\
ziDszmWwfM+My2ajLMr8y+eczTRm9TFadjb3VudGVyAKtzaWduaW5nX2tlecQgefpCr6Duu7QUWzKIeMOFmxv/\
NjfcsYwZz8IN2ZOhdaS0c2lnbmluZ19rZXlfdmVyaWZpZWTDpmNvbmZpZ4GndmVyc2lvbqJWMapzZW5kZXJfa2\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pNRjgvNjZzq3NlbmRlcl9kYXRhgbBTZW\
5kZXJVbnZlcmlmaWVkg6d1c2VyX2lks0B2YWxvdTM1Om1hdHJpeC5vcmepZGV2aWNlX2lkqkZJQlNaRlJLUE2q\
bWFzdGVyX2tlecQgkOp9s4ClyQujYD7rRZA8xgE6kvYlqKSNnMrQNmSrcuGncm9vbV9pZL4hRWt5VEtGdkViYl\
B6SmxhaUhFOm1hdHJpeC5vcmeoaW1wb3J0ZWTCqWJhY2tlZF91cMKyaGlzdG9yeV92aXNpYmlsaXR5wKlhbGdv\
cml0aG20bS5tZWdvbG0udjEuYWVzLXNoYTI";

let input = base64_decode(SERIALIZED_B64).unwrap();
let sender_data: PickledInboundGroupSession = rmp_serde::from_slice(&input)
Expand Down
10 changes: 8 additions & 2 deletions crates/matrix-sdk-crypto/src/secret_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,17 @@ pub enum DecodeError {
Mac(#[from] MacError),
/// The MAC of the secret storage key for the MAC check has an incorrect
/// length.
#[error("The MAC of for the secret storage MAC check has an incorrect length, expected: {0}, got: {1}")]
#[error(
"The MAC of for the secret storage MAC check has an incorrect length, \
expected: {0}, got: {1}"
)]
MacLength(usize, usize),
/// The IV of the secret storage key for the MAC check has an incorrect
/// length.
#[error("The IV of for the secret storage key MAC check has an incorrect length, expected: {0}, got: {1}")]
#[error(
"The IV of for the secret storage key MAC check has an incorrect length, \
expected: {0}, got: {1}"
)]
IvLength(usize, usize),
/// The secret storage key is using an unsupported secret encryption
/// algorithm. Currently only the [`m.secret_storage.v1.aes-hmac-sha2`]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,12 @@ pub(crate) async fn collect_recipients_for_share_strategy(
None => {
return Err(OlmError::SessionRecipientCollectionError(
SessionRecipientCollectionError::CrossSigningNotSetup,
))
));
}
Some(identity) if !identity.is_verified() => {
return Err(OlmError::SessionRecipientCollectionError(
SessionRecipientCollectionError::SendingFromUnverifiedDevice,
))
));
}
Some(_) => (),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ impl CryptoStoreWrapper {
let own_identity_is_verified = own_identity_after.is_verified();

if !own_identity_was_verified_before_change && own_identity_is_verified {
debug!("Own identity is now verified, check all known identities for verification status changes");
debug!(
"Own identity is now verified, check all known identities for verification status changes"
);
// We need to review all the other identities to see if they are verified now
// and mark them as such
self.check_all_identities_and_update_was_previously_verified_flag_if_needed(
Expand Down
10 changes: 5 additions & 5 deletions crates/matrix-sdk-crypto/src/types/qr_login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ mod test {
];

// Test vector for the QR code data in base64 format, self-generated.
const QR_CODE_DATA_BASE64: &str =
"TUFUUklYAgS0yzZ1QVpQ1jlnoxWX3d5jrWRFfELxjS2gN7pz9y+3PABaaHR0\
cHM6Ly9zeW5hcHNlLW9pZGMubGFiLmVsZW1lbnQuZGV2L19zeW5hcHNlL2Ns\
aWVudC9yZW5kZXp2b3VzLzAxSFg5SzAwUTFINktQRDQ3RUc0RzFUM1hHACVo\
dHRwczovL3N5bmFwc2Utb2lkYy5sYWIuZWxlbWVudC5kZXYv";
const QR_CODE_DATA_BASE64: &str = "\
TUFUUklYAgS0yzZ1QVpQ1jlnoxWX3d5jrWRFfELxjS2gN7pz9y+3PABaaHR0\
cHM6Ly9zeW5hcHNlLW9pZGMubGFiLmVsZW1lbnQuZGV2L19zeW5hcHNlL2Ns\
aWVudC9yZW5kZXp2b3VzLzAxSFg5SzAwUTFINktQRDQ3RUc0RzFUM1hHACVo\
dHRwczovL3N5bmFwc2Utb2lkYy5sYWIuZWxlbWVudC5kZXYv";

#[test]
fn parse_qr_data() {
Expand Down
5 changes: 4 additions & 1 deletion crates/matrix-sdk-crypto/src/verification/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,10 @@ impl VerificationMachine {
let Some(device_data) =
self.store.get_device(event.sender(), r.from_device()).await?
else {
warn!("Could not retrieve the device data for the incoming verification request, ignoring it");
warn!(
"Could not retrieve the device data for the incoming verification request, \
ignoring it"
);
return Ok(());
};

Expand Down
10 changes: 7 additions & 3 deletions crates/matrix-sdk-crypto/src/verification/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ impl InnerRequest {
s.clone().into_canceled(cancelled_by_us, cancel_code)
}
InnerRequest::Passive(_) | InnerRequest::Done(_) | InnerRequest::Cancelled(_) => {
return None
return None;
}
});

Expand Down Expand Up @@ -1390,11 +1390,15 @@ async fn receive_start<T: Clone>(
),
(Ordering::Greater, _) | (Ordering::Equal, Ordering::Greater)
) {
info!("Started a new SAS verification, replacing an already started one.");
info!(
"Started a new SAS verification, replacing an already started one."
);
request_state.verification_cache.replace_sas(new.to_owned());
Ok(Some(state.to_transitioned(request_state, new.into())))
} else {
info!("Ignored incoming SAS verification from lexicographically larger user/device ID.");
info!(
"Ignored incoming SAS verification from lexicographically larger user/device ID."
);
Ok(None)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ pub(crate) async fn data_migrate(name: &str, serializer: &IndexeddbSerializer) -
}

if !cursor.continue_cursor()?.await? {
debug!("Migrated {row_count} sessions: {updated} keys updated and {deleted} obsolete entries deleted.");
debug!(
"Migrated {row_count} sessions: {updated} keys updated \
and {deleted} obsolete entries deleted."
);
break;
}
}
Expand Down
9 changes: 7 additions & 2 deletions crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ pub enum IndexeddbCryptoStoreError {
},
#[error(transparent)]
CryptoStoreError(#[from] CryptoStoreError),
#[error("The schema version of the crypto store is too new. Existing version: {current_version}; max supported version: {max_supported_version}")]
#[error(
"The schema version of the crypto store is too new. \
Existing version: {current_version}; max supported version: {max_supported_version}"
)]
SchemaTooNewError { max_supported_version: u32, current_version: u32 },
}

Expand Down Expand Up @@ -1581,7 +1584,9 @@ async fn import_store_cipher_with_key(
// Loading the cipher with the passphrase was successful. Let's update the
// stored version of the cipher so that it is encrypted with a key,
// to save doing this again.
debug!("IndexedDbCryptoStore: Migrating passphrase-encrypted store cipher to key-encryption");
debug!(
"IndexedDbCryptoStore: Migrating passphrase-encrypted store cipher to key-encryption"
);

let export = cipher.export_with_key(chacha_key).map_err(CryptoStoreError::backend)?;
save_store_cipher(db, &export).await?;
Expand Down
5 changes: 4 additions & 1 deletion crates/matrix-sdk-indexeddb/src/state_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ pub enum IndexeddbStateStoreError {
DomException { name: String, message: String, code: u16 },
#[error(transparent)]
StoreError(#[from] StoreError),
#[error("Can't migrate {name} from {old_version} to {new_version} without deleting data. See MigrationConflictStrategy for ways to configure.")]
#[error(
"Can't migrate {name} from {old_version} to {new_version} without deleting data. \
See MigrationConflictStrategy for ways to configure."
)]
MigrationConflict { name: String, old_version: u32, new_version: u32 },
}

Expand Down
5 changes: 4 additions & 1 deletion crates/matrix-sdk-store-encryption/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ pub enum Error {

/// Failed to import a store cipher, the export used a passphrase while
/// we are trying to import it using a key or vice-versa.
#[error("Failed to import a store cipher, the export used a passphrase while we are trying to import it using a key or vice-versa")]
#[error(
"Failed to import a store cipher, the export used a passphrase while we are trying to \
import it using a key or vice-versa"
)]
KdfMismatch,
}

Expand Down
10 changes: 8 additions & 2 deletions crates/matrix-sdk-ui/src/timeline/controller/aggregations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,10 @@ impl Aggregations {
};

let Some(aggregation) = aggregation else {
warn!("incorrect internal state: {aggregation_id:?} was present in the inverted map, not in related-to map.");
warn!(
"incorrect internal state: {aggregation_id:?} was present in the inverted map, \
not in related-to map."
);
return Ok(false);
};

Expand Down Expand Up @@ -807,6 +810,9 @@ pub(crate) enum AggregationError {
#[error("a redaction can't be unapplied")]
CantUndoRedaction,

#[error("trying to apply an aggregation of one type to an invalid target: expected {expected}, actual {actual}")]
#[error(
"trying to apply an aggregation of one type to an invalid target: \
expected {expected}, actual {actual}"
)]
InvalidType { expected: String, actual: String },
}
Loading
Loading