From 1e365439314053c255a0ead0b0b9eb8a84a4995e Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 9 Jan 2025 20:06:02 +0100 Subject: [PATCH 1/2] chore: Fix new nightly warnings --- bindings/matrix-sdk-ffi/src/timeline/mod.rs | 2 +- crates/matrix-sdk-common/src/linked_chunk/as_vector.rs | 2 +- crates/matrix-sdk/src/oidc/mod.rs | 6 ++---- examples/persist_session/src/main.rs | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bindings/matrix-sdk-ffi/src/timeline/mod.rs b/bindings/matrix-sdk-ffi/src/timeline/mod.rs index 5773717714b..7a4df082f0d 100644 --- a/bindings/matrix-sdk-ffi/src/timeline/mod.rs +++ b/bindings/matrix-sdk-ffi/src/timeline/mod.rs @@ -123,7 +123,7 @@ impl Timeline { .thumbnail(thumbnail) .info(attachment_info) .caption(params.caption) - .formatted_caption(formatted_caption.map(Into::into)) + .formatted_caption(formatted_caption) .mentions(params.mentions.map(Into::into)); let handle = SendAttachmentJoinHandle::new(RUNTIME.spawn(async move { diff --git a/crates/matrix-sdk-common/src/linked_chunk/as_vector.rs b/crates/matrix-sdk-common/src/linked_chunk/as_vector.rs index e9bfe0c6008..c0d65af1c15 100644 --- a/crates/matrix-sdk-common/src/linked_chunk/as_vector.rs +++ b/crates/matrix-sdk-common/src/linked_chunk/as_vector.rs @@ -803,7 +803,7 @@ mod tests { assert_items_eq!(linked_chunk, ['a', 'b', 'c'] ['d']); // Empty updates first. - let _ = linked_chunk.updates().take(); + let _ = linked_chunk.updates().unwrap().take(); // Start observing future updates. let mut as_vector = linked_chunk.as_vector().unwrap(); diff --git a/crates/matrix-sdk/src/oidc/mod.rs b/crates/matrix-sdk/src/oidc/mod.rs index 4c20e085153..86f3e7f5295 100644 --- a/crates/matrix-sdk/src/oidc/mod.rs +++ b/crates/matrix-sdk/src/oidc/mod.rs @@ -1160,8 +1160,7 @@ impl Oidc { #[cfg(feature = "e2e-encryption")] None, ) - .await - .map_err(crate::Error::from)?; + .await?; // At this point the Olm machine has been set up. // Enable the cross-process lock for refreshes, if needs be. @@ -1313,8 +1312,7 @@ impl Oidc { refresh_token.clone(), latest_id_token.clone(), ) - .await - .map_err(OidcError::from)?; + .await?; trace!( "Token refresh: new refresh_token: {} / access_token: {:x}", diff --git a/examples/persist_session/src/main.rs b/examples/persist_session/src/main.rs index 81b40545da1..b3b9a9e1cd2 100644 --- a/examples/persist_session/src/main.rs +++ b/examples/persist_session/src/main.rs @@ -77,7 +77,7 @@ async fn main() -> anyhow::Result<()> { (login(&data_dir, &session_file).await?, None) }; - sync(client, sync_token, &session_file).await.map_err(Into::into) + sync(client, sync_token, &session_file).await } /// Restore a previous session. From edfdbc28d842a10e54f2192a42636810e1ec1ba2 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 9 Jan 2025 20:59:31 +0100 Subject: [PATCH 2/2] refactor(common): Warn if LinkedChunk::updates() return value is not used --- crates/matrix-sdk-common/src/linked_chunk/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/matrix-sdk-common/src/linked_chunk/mod.rs b/crates/matrix-sdk-common/src/linked_chunk/mod.rs index b8f14589ad4..113edbdc8c4 100644 --- a/crates/matrix-sdk-common/src/linked_chunk/mod.rs +++ b/crates/matrix-sdk-common/src/linked_chunk/mod.rs @@ -897,6 +897,7 @@ impl LinkedChunk { /// It returns `None` if updates are disabled, i.e. if this linked chunk has /// been constructed with [`Self::new`], otherwise, if it's been constructed /// with [`Self::new_with_update_history`], it returns `Some(…)`. + #[must_use] pub fn updates(&mut self) -> Option<&mut ObservableUpdates> { self.updates.as_mut() }