Skip to content

Commit

Permalink
refactor: Fully replace matches crate with assert_matches
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Jan 10, 2023
1 parent db1d31c commit 3af6ba2
Show file tree
Hide file tree
Showing 17 changed files with 16 additions and 24 deletions.
9 changes: 1 addition & 8 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ tokio = { version = "1.23", default-features = false, features = ["time"] }

[dev-dependencies]
anyhow = "1.0.65"
assert_matches = "1.5.0"
futures = { version = "0.3.21", default-features = false, features = ["executor"] }
http = "0.2.6"
indoc = "1.0.4"
matches = "0.1.9"
matrix-sdk-test = { version = "0.6.0", path = "../../testing/matrix-sdk-test" }
proptest = { version = "1.0.0", default-features = false, features = ["std"] }
# required for async_test macro
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/gossiping/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,8 +1006,8 @@ impl GossipMachine {
mod tests {
use std::sync::Arc;

use assert_matches::assert_matches;
use dashmap::DashMap;
use matches::assert_matches;
use matrix_sdk_common::locks::Mutex;
use matrix_sdk_test::async_test;
use ruma::{
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ pub(crate) mod testing {
pub(crate) mod tests {
use std::{collections::BTreeMap, iter, sync::Arc};

use matches::assert_matches;
use assert_matches::assert_matches;
use matrix_sdk_test::{async_test, test_json};
use ruma::{
api::{
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/olm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub use vodozemac::{olm::IdentityKeys, Curve25519PublicKey};

#[cfg(test)]
pub(crate) mod tests {
use matches::assert_matches;
use assert_matches::assert_matches;
use matrix_sdk_test::async_test;
use ruma::{
device_id, event_id,
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/types/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Serialize for RoomKeyBackupInfo {

#[cfg(test)]
mod test {
use matches::assert_matches;
use assert_matches::assert_matches;
use serde_json::json;

use super::RoomKeyBackupInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ scheme_serialization!(

#[cfg(test)]
pub(crate) mod test {
use matches::assert_matches;
use assert_matches::assert_matches;
use serde_json::{json, Value};
use vodozemac::Curve25519PublicKey;

Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/types/events/room_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl Serialize for RoomKeyContent {

#[cfg(test)]
pub(super) mod test {
use matches::assert_matches;
use assert_matches::assert_matches;
use serde_json::{json, Value};

use super::RoomKeyEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl TryFrom<RequestedKeyInfoHelper> for RequestedKeyInfo {

#[cfg(test)]
mod test {
use matches::assert_matches;
use assert_matches::assert_matches;
use serde_json::{json, Value};

use super::{Action, RequestedKeyInfo, RoomKeyRequestEvent};
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/types/events/to_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ impl Serialize for ToDeviceEvents {

#[cfg(test)]
mod test {
use matches::assert_matches;
use assert_matches::assert_matches;
use serde_json::{json, Value};

use super::ToDeviceEvents;
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/types/one_time_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub enum OneTimeKey {

#[cfg(test)]
mod tests {
use matches::assert_matches;
use assert_matches::assert_matches;
use ruma::{device_id, user_id, DeviceKeyAlgorithm, DeviceKeyId};
use serde_json::json;
use vodozemac::{Curve25519PublicKey, Ed25519Signature};
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/verification/qrcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ impl QrState<Reciprocated> {
mod tests {
use std::sync::Arc;

use matches::assert_matches;
use assert_matches::assert_matches;
use matrix_sdk_common::locks::Mutex;
use matrix_sdk_qrcode::QrVerificationData;
use matrix_sdk_test::async_test;
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/verification/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ mod tests {

use std::convert::{TryFrom, TryInto};

use matches::assert_matches;
use assert_matches::assert_matches;
#[cfg(feature = "qrcode")]
use matrix_sdk_qrcode::QrVerificationData;
use matrix_sdk_test::async_test;
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/verification/sas/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ impl AcceptSettings {
mod tests {
use std::sync::Arc;

use matches::assert_matches;
use assert_matches::assert_matches;
use matrix_sdk_common::locks::Mutex;
use matrix_sdk_test::async_test;
use ruma::{device_id, user_id, DeviceId, TransactionId, UserId};
Expand Down
1 change: 0 additions & 1 deletion crates/matrix-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ anyhow = "1.0.57"
assert_matches = "1.5.0"
dirs = "4.0.0"
futures = { version = "0.3.21", default-features = false, features = ["executor"] }
matches = "0.1.9"
matrix-sdk-test = { version = "0.6.0", path = "../../testing/matrix-sdk-test" }
once_cell = "1.10.0"
serde_json = "1.0.79"
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/tests/integration/refresh_token.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::time::Duration;

use assert_matches::assert_matches;
use futures::{
channel::{mpsc, oneshot},
StreamExt,
};
use futures_signals::signal::SignalExt;
use matches::assert_matches;
use matrix_sdk::{config::RequestConfig, executor::spawn, HttpError, RefreshTokenError, Session};
use matrix_sdk_test::{async_test, test_json};
use ruma::{
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/tests/integration/room/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async fn test_state_event_getting() {
.deserialize()
.unwrap();

matches::assert_matches!(encryption_event, AnySyncStateEvent::RoomEncryption(_));
assert_matches::assert_matches!(encryption_event, AnySyncStateEvent::RoomEncryption(_));
}

#[async_test]
Expand Down

0 comments on commit 3af6ba2

Please sign in to comment.