From b5bda577dd993dcee750cfead43d686e2df7f80c Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 22 Feb 2024 08:27:54 +0100 Subject: [PATCH] chore(sdk): Remove useless imports or fix unused code. --- .../src/backups/keys/decryption.rs | 1 - crates/matrix-sdk/src/client/builder.rs | 30 +++++++++---------- crates/matrix-sdk/src/media.rs | 2 -- crates/matrix-sdk/src/room/power_levels.rs | 6 +--- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/backups/keys/decryption.rs b/crates/matrix-sdk-crypto/src/backups/keys/decryption.rs index 739cb92d9..4b0cca650 100644 --- a/crates/matrix-sdk-crypto/src/backups/keys/decryption.rs +++ b/crates/matrix-sdk-crypto/src/backups/keys/decryption.rs @@ -17,7 +17,6 @@ use std::{ ops::DerefMut, }; -use bs58; use ruma::api::client::backup::EncryptedSessionData; use thiserror::Error; use vodozemac::Curve25519PublicKey; diff --git a/crates/matrix-sdk/src/client/builder.rs b/crates/matrix-sdk/src/client/builder.rs index 22ca85607..c000075ba 100644 --- a/crates/matrix-sdk/src/client/builder.rs +++ b/crates/matrix-sdk/src/client/builder.rs @@ -862,13 +862,13 @@ pub(crate) mod tests { // When building a client with the server's URL. builder = builder.server_name_or_homeserver_url(homeserver.uri()); - let client = builder.build().await.unwrap(); + let _client = builder.build().await.unwrap(); // Then a client should be built without support for sliding sync or OIDC. #[cfg(feature = "experimental-sliding-sync")] - assert!(client.sliding_sync_proxy().is_none()); + assert!(_client.sliding_sync_proxy().is_none()); #[cfg(feature = "experimental-oidc")] - assert!(client.oidc().authentication_server_info().is_none()); + assert!(_client.oidc().authentication_server_info().is_none()); } #[async_test] @@ -884,13 +884,13 @@ pub(crate) mod tests { // When building a client with the server's URL. builder = builder.server_name_or_homeserver_url(homeserver.uri()); - let client = builder.build().await.unwrap(); + let _client = builder.build().await.unwrap(); // Then a client should be built with support for sliding sync. #[cfg(feature = "experimental-sliding-sync")] - assert_eq!(client.sliding_sync_proxy(), Some("https://localhost:1234".parse().unwrap())); + assert_eq!(_client.sliding_sync_proxy(), Some("https://localhost:1234".parse().unwrap())); #[cfg(feature = "experimental-oidc")] - assert!(client.oidc().authentication_server_info().is_none()); + assert!(_client.oidc().authentication_server_info().is_none()); } #[async_test] @@ -939,13 +939,13 @@ pub(crate) mod tests { // When building a client with the base server. builder = builder.server_name_or_homeserver_url(server.uri()); - let client = builder.build().await.unwrap(); + let _client = builder.build().await.unwrap(); // Then a client should be built without support for sliding sync or OIDC. #[cfg(feature = "experimental-sliding-sync")] - assert!(client.sliding_sync_proxy().is_none()); + assert!(_client.sliding_sync_proxy().is_none()); #[cfg(feature = "experimental-oidc")] - assert!(client.oidc().authentication_server_info().is_none()); + assert!(_client.oidc().authentication_server_info().is_none()); } #[async_test] @@ -968,13 +968,13 @@ pub(crate) mod tests { // When building a client with the base server. builder = builder.server_name_or_homeserver_url(server.uri()); - let client = builder.build().await.unwrap(); + let _client = builder.build().await.unwrap(); // Then a client should be built with support for sliding sync. #[cfg(feature = "experimental-sliding-sync")] - assert_eq!(client.sliding_sync_proxy(), Some("https://localhost:1234".parse().unwrap())); + assert_eq!(_client.sliding_sync_proxy(), Some("https://localhost:1234".parse().unwrap())); #[cfg(feature = "experimental-oidc")] - assert!(client.oidc().authentication_server_info().is_none()); + assert!(_client.oidc().authentication_server_info().is_none()); } #[async_test] @@ -1030,14 +1030,14 @@ pub(crate) mod tests { // When building a client with the base server. builder = builder.server_name_or_homeserver_url(server.uri()); - let client = builder.build().await.unwrap(); + let _client = builder.build().await.unwrap(); // Then a client should be built with support for both sliding sync and OIDC. #[cfg(feature = "experimental-sliding-sync")] - assert_eq!(client.sliding_sync_proxy(), Some("https://localhost:1234".parse().unwrap())); + assert_eq!(_client.sliding_sync_proxy(), Some("https://localhost:1234".parse().unwrap())); #[cfg(feature = "experimental-oidc")] assert_eq!( - client.oidc().authentication_server_info().unwrap().issuer, + _client.oidc().authentication_server_info().unwrap().issuer, "https://localhost:5678".to_owned() ); } diff --git a/crates/matrix-sdk/src/media.rs b/crates/matrix-sdk/src/media.rs index 5d9de6b5b..8516d3d95 100644 --- a/crates/matrix-sdk/src/media.rs +++ b/crates/matrix-sdk/src/media.rs @@ -25,8 +25,6 @@ use eyeball::SharedObservable; use futures_util::future::try_join; pub use matrix_sdk_base::media::*; use mime::Mime; -#[cfg(not(target_arch = "wasm32"))] -use mime2ext; use ruma::{ api::client::media::{create_content, get_content, get_content_thumbnail}, assign, diff --git a/crates/matrix-sdk/src/room/power_levels.rs b/crates/matrix-sdk/src/room/power_levels.rs index 4e891f863..4b272280b 100644 --- a/crates/matrix-sdk/src/room/power_levels.rs +++ b/crates/matrix-sdk/src/room/power_levels.rs @@ -199,11 +199,7 @@ pub fn power_level_user_changes( mod tests { use std::collections::BTreeMap; - use ruma::{ - events::room::power_levels::{RoomPowerLevels, RoomPowerLevelsEventContent}, - int, - power_levels::NotificationPowerLevels, - }; + use ruma::{int, power_levels::NotificationPowerLevels}; use super::*;