From 5bebe1d434d583cb591ab9891c9608ce53a0dfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 15 Jul 2020 15:58:36 +0200 Subject: [PATCH] crypto: Clippy fixes for our tests. --- matrix_sdk_crypto/src/memory_stores.rs | 4 ++-- matrix_sdk_crypto/src/olm.rs | 4 ++-- matrix_sdk_crypto/src/store/memorystore.rs | 4 ++-- matrix_sdk_crypto/src/store/sqlite.rs | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/matrix_sdk_crypto/src/memory_stores.rs b/matrix_sdk_crypto/src/memory_stores.rs index be7aba34..f38f476e 100644 --- a/matrix_sdk_crypto/src/memory_stores.rs +++ b/matrix_sdk_crypto/src/memory_stores.rs @@ -292,8 +292,8 @@ mod test { let user_devices = store.user_devices(device.user_id()); - assert_eq!(user_devices.keys().nth(0).unwrap(), device.device_id()); - assert_eq!(user_devices.devices().nth(0).unwrap(), &device); + assert_eq!(user_devices.keys().next().unwrap(), device.device_id()); + assert_eq!(user_devices.devices().next().unwrap(), &device); let loaded_device = user_devices.get(device.device_id()).unwrap(); diff --git a/matrix_sdk_crypto/src/olm.rs b/matrix_sdk_crypto/src/olm.rs index aece7912..5c4f6f0d 100644 --- a/matrix_sdk_crypto/src/olm.rs +++ b/matrix_sdk_crypto/src/olm.rs @@ -1066,7 +1066,7 @@ pub(crate) mod test { .await .curve25519() .iter() - .nth(0) + .next() .unwrap() .1 .to_owned(); @@ -1143,7 +1143,7 @@ pub(crate) mod test { let one_time_key = one_time_keys .curve25519() .iter() - .nth(0) + .next() .unwrap() .1 .to_owned(); diff --git a/matrix_sdk_crypto/src/store/memorystore.rs b/matrix_sdk_crypto/src/store/memorystore.rs index ccef2efd..a911320f 100644 --- a/matrix_sdk_crypto/src/store/memorystore.rs +++ b/matrix_sdk_crypto/src/store/memorystore.rs @@ -200,8 +200,8 @@ mod test { let user_devices = store.get_user_devices(device.user_id()).await.unwrap(); - assert_eq!(user_devices.keys().nth(0).unwrap(), device.device_id()); - assert_eq!(user_devices.devices().nth(0).unwrap(), &device); + assert_eq!(user_devices.keys().next().unwrap(), device.device_id()); + assert_eq!(user_devices.devices().next().unwrap(), &device); let loaded_device = user_devices.get(device.device_id()).unwrap(); diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index bfa26664..cfda0a62 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -866,7 +866,7 @@ mod test { .await .curve25519() .iter() - .nth(0) + .next() .unwrap() .1 .to_owned(); @@ -1165,8 +1165,8 @@ mod test { assert_eq!(device.keys(), loaded_device.keys()); let user_devices = store.get_user_devices(device.user_id()).await.unwrap(); - assert_eq!(user_devices.keys().nth(0).unwrap(), device.device_id()); - assert_eq!(user_devices.devices().nth(0).unwrap(), &device); + assert_eq!(user_devices.keys().next().unwrap(), device.device_id()); + assert_eq!(user_devices.devices().next().unwrap(), &device); } #[tokio::test]