From 130dc58a5d8f378ab6e9681d1dbbbc2bad1076ca Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Mon, 20 Mar 2023 12:24:14 +0100 Subject: [PATCH] Remove redundant cfg attributes The whole encryption module is only enabled with e2e-encryption. --- crates/matrix-sdk/src/encryption/mod.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/crates/matrix-sdk/src/encryption/mod.rs b/crates/matrix-sdk/src/encryption/mod.rs index 1222a65ce..9db51849d 100644 --- a/crates/matrix-sdk/src/encryption/mod.rs +++ b/crates/matrix-sdk/src/encryption/mod.rs @@ -38,8 +38,6 @@ pub use matrix_sdk_base::crypto::{ use matrix_sdk_base::crypto::{ CrossSigningStatus, OutgoingRequest, RoomMessageRequest, ToDeviceRequest, }; -#[cfg(feature = "e2e-encryption")] -use ruma::OwnedDeviceId; use ruma::{ api::client::{ backup::add_backup_keys::v3::Response as KeysBackupResponse, @@ -52,7 +50,7 @@ use ruma::{ }, uiaa::AuthData, }, - assign, DeviceId, OwnedUserId, TransactionId, UserId, + assign, DeviceId, OwnedDeviceId, OwnedUserId, TransactionId, UserId, }; use tracing::{debug, instrument, trace, warn}; @@ -68,12 +66,10 @@ use crate::{ }; impl Client { - #[cfg(feature = "e2e-encryption")] pub(crate) fn olm_machine(&self) -> Option<&matrix_sdk_base::crypto::OlmMachine> { self.base_client().olm_machine() } - #[cfg(feature = "e2e-encryption")] pub(crate) async fn mark_request_as_sent( &self, request_id: &TransactionId, @@ -93,7 +89,6 @@ impl Client { /// # Panics /// /// Panics if no key query needs to be done. - #[cfg(feature = "e2e-encryption")] #[instrument(skip(self))] pub(crate) async fn keys_query( &self, @@ -140,7 +135,6 @@ impl Client { /// room.send(CustomEventContent { encrypted_file }, None).await?; /// # anyhow::Ok(()) }); /// ``` - #[cfg(feature = "e2e-encryption")] pub async fn prepare_encrypted_file<'a, R: Read + ?Sized + 'a>( &self, content_type: &mime::Mime, @@ -170,7 +164,6 @@ impl Client { /// Encrypt and upload the file to be read from `reader` and construct an /// attachment message with `body`, `content_type`, `info` and `thumbnail`. - #[cfg(feature = "e2e-encryption")] pub(crate) async fn prepare_encrypted_attachment_message( &self, body: &str, @@ -257,7 +250,6 @@ impl Client { /// # Arguments /// /// * `users` - The list of user/device pairs that we should claim keys for. - #[cfg(feature = "e2e-encryption")] pub(crate) async fn claim_one_time_keys( &self, users: impl Iterator, @@ -286,7 +278,6 @@ impl Client { /// /// Panics if the client isn't logged in, or if no encryption keys need to /// be uploaded. - #[cfg(feature = "e2e-encryption")] #[instrument(skip(self, request))] pub(crate) async fn keys_upload( &self, @@ -305,7 +296,6 @@ impl Client { Ok(response) } - #[cfg(feature = "e2e-encryption")] pub(crate) async fn room_send_helper( &self, request: &RoomMessageRequest, @@ -320,7 +310,6 @@ impl Client { .await } - #[cfg(feature = "e2e-encryption")] pub(crate) async fn send_to_device( &self, request: &ToDeviceRequest, @@ -334,7 +323,6 @@ impl Client { self.send(request, None).await } - #[cfg(feature = "e2e-encryption")] pub(crate) async fn send_verification_request( &self, request: matrix_sdk_base::crypto::OutgoingVerificationRequest, @@ -351,7 +339,6 @@ impl Client { Ok(()) } - #[cfg(feature = "e2e-encryption")] fn get_dm_room(&self, user_id: &UserId) -> Option { let rooms = self.joined_rooms(); @@ -444,14 +431,12 @@ impl Client { /// A high-level API to manage the client's encryption. /// /// To get this, use [`Client::encryption()`]. -#[cfg(feature = "e2e-encryption")] #[derive(Debug, Clone)] pub struct Encryption { /// The underlying client. client: Client, } -#[cfg(feature = "e2e-encryption")] impl Encryption { pub(crate) fn new(client: Client) -> Self { Self { client }