diff --git a/benchmarks/benches/room_bench.rs b/benchmarks/benches/room_bench.rs index 3a0b3f12e..51fb30a57 100644 --- a/benchmarks/benches/room_bench.rs +++ b/benchmarks/benches/room_bench.rs @@ -29,7 +29,7 @@ pub fn receive_all_members_benchmark(c: &mut Criterion) { let f = EventFactory::new().room(&room_id); let mut member_events: Vec> = Vec::with_capacity(MEMBERS_IN_ROOM); for i in 0..MEMBERS_IN_ROOM { - let user_id = OwnedUserId::try_from(format!("@user_{}:matrix.org", i)).unwrap(); + let user_id = OwnedUserId::try_from(format!("@user_{i}:matrix.org")).unwrap(); let event = f .member(&user_id) .membership(MembershipState::Join) diff --git a/bindings/matrix-sdk-ffi/src/client.rs b/bindings/matrix-sdk-ffi/src/client.rs index 5b32199a8..9c8318b15 100644 --- a/bindings/matrix-sdk-ffi/src/client.rs +++ b/bindings/matrix-sdk-ffi/src/client.rs @@ -2338,7 +2338,7 @@ impl TryFrom for JoinRule { } RumaJoinRule::Invite => Ok(JoinRule::Invite), RumaJoinRule::_Custom(_) => Ok(JoinRule::Custom { repr: value.as_str().to_owned() }), - _ => Err(format!("Unknown JoinRule: {:?}", value)), + _ => Err(format!("Unknown JoinRule: {value:?}")), } } } @@ -2355,7 +2355,7 @@ impl TryFrom for AllowRule { .map_err(|e| format!("Couldn't serialize custom AllowRule: {e:?}"))?; Ok(Self::Custom { json }) } - _ => Err(format!("Invalid AllowRule: {:?}", value)), + _ => Err(format!("Invalid AllowRule: {value:?}")), } } } diff --git a/bindings/matrix-sdk-ffi/src/notification_settings.rs b/bindings/matrix-sdk-ffi/src/notification_settings.rs index 977127c2a..c5a1850fd 100644 --- a/bindings/matrix-sdk-ffi/src/notification_settings.rs +++ b/bindings/matrix-sdk-ffi/src/notification_settings.rs @@ -290,7 +290,7 @@ impl TryFrom for Tweak { SdkTweak::Highlight(highlight) => Self::Highlight { value: highlight }, SdkTweak::Custom { name, value } => { let json_string = serde_json::to_string(&value) - .map_err(|e| format!("Failed to serialize custom tweak value: {}", e))?; + .map_err(|e| format!("Failed to serialize custom tweak value: {e}"))?; Self::Custom { name, value: json_string } } @@ -308,9 +308,9 @@ impl TryFrom for SdkTweak { Tweak::Highlight { value } => Self::Highlight(value), Tweak::Custom { name, value } => { let json_value: serde_json::Value = serde_json::from_str(&value) - .map_err(|e| format!("Failed to deserialize custom tweak value: {}", e))?; + .map_err(|e| format!("Failed to deserialize custom tweak value: {e}"))?; let value = serde_json::from_value(json_value) - .map_err(|e| format!("Failed to convert JSON value: {}", e))?; + .map_err(|e| format!("Failed to convert JSON value: {e}"))?; Self::Custom { name, value } } @@ -334,7 +334,7 @@ impl TryFrom for Action { Ok(match value { SdkAction::Notify => Self::Notify, SdkAction::SetTweak(tweak) => Self::SetTweak { - value: tweak.try_into().map_err(|e| format!("Failed to convert tweak: {}", e))?, + value: tweak.try_into().map_err(|e| format!("Failed to convert tweak: {e}"))?, }, _ => return Err("Unsupported action type".to_owned()), }) @@ -348,7 +348,7 @@ impl TryFrom for SdkAction { Ok(match value { Action::Notify => Self::Notify, Action::SetTweak { value } => Self::SetTweak( - value.try_into().map_err(|e| format!("Failed to convert tweak: {}", e))?, + value.try_into().map_err(|e| format!("Failed to convert tweak: {e}"))?, ), }) } diff --git a/bindings/matrix-sdk-ffi/src/ruma.rs b/bindings/matrix-sdk-ffi/src/ruma.rs index d251b7dd1..7592afaf1 100644 --- a/bindings/matrix-sdk-ffi/src/ruma.rs +++ b/bindings/matrix-sdk-ffi/src/ruma.rs @@ -182,10 +182,10 @@ impl From<&RumaMatrixId> for MatrixId { event_id: event_id.to_string(), } } else { - panic!("Unexpected MatrixId type: {:?}", room_id_or_alias) + panic!("Unexpected MatrixId type: {room_id_or_alias:?}") } } - _ => panic!("Unexpected MatrixId type: {:?}", value), + _ => panic!("Unexpected MatrixId type: {value:?}"), } } } diff --git a/bindings/matrix-sdk-ffi/src/widget.rs b/bindings/matrix-sdk-ffi/src/widget.rs index 86e301f6d..480918536 100644 --- a/bindings/matrix-sdk-ffi/src/widget.rs +++ b/bindings/matrix-sdk-ffi/src/widget.rs @@ -647,8 +647,7 @@ mod tests { let cap_assert = |capability: &str| { assert!( permission_array.contains(&capability.to_owned()), - "The \"{}\" capability was missing from the element call capability list.", - capability + "The \"{capability}\" capability was missing from the element call capability list." ); }; diff --git a/crates/matrix-sdk-base/src/room/display_name.rs b/crates/matrix-sdk-base/src/room/display_name.rs index eba4947d4..e4e7cfac5 100644 --- a/crates/matrix-sdk-base/src/room/display_name.rs +++ b/crates/matrix-sdk-base/src/room/display_name.rs @@ -472,7 +472,7 @@ fn compute_display_name_from_heroes( heroes.sort_unstable(); let names = if num_heroes == 0 && num_joined_invited > 1 { - format!("{} people", num_joined_invited) + format!("{num_joined_invited} people") } else if num_heroes >= num_joined_invited_except_self { heroes.join(", ") } else if num_heroes < num_joined_invited_except_self && num_joined_invited > 1 { diff --git a/crates/matrix-sdk-base/src/room/state.rs b/crates/matrix-sdk-base/src/room/state.rs index c220c2fb3..69a26ad47 100644 --- a/crates/matrix-sdk-base/src/room/state.rs +++ b/crates/matrix-sdk-base/src/room/state.rs @@ -49,7 +49,7 @@ impl From<&MembershipState> for RoomState { MembershipState::Join => Self::Joined, MembershipState::Knock => Self::Knocked, MembershipState::Leave => Self::Left, - _ => panic!("Unexpected MembershipState: {}", membership_state), + _ => panic!("Unexpected MembershipState: {membership_state}"), } } } diff --git a/crates/matrix-sdk-sqlite/src/crypto_store.rs b/crates/matrix-sdk-sqlite/src/crypto_store.rs index b745f095e..bfcb2fe26 100644 --- a/crates/matrix-sdk-sqlite/src/crypto_store.rs +++ b/crates/matrix-sdk-sqlite/src/crypto_store.rs @@ -1739,7 +1739,7 @@ mod tests { let olm_sessions = database.get_sessions(id).await.expect("Should have some olm sessions"); - println!("### Session id: {:?}", id); + println!("### Session id: {id:?}"); assert_eq!(olm_sessions.map_or(0, |v| v.len()), count); } diff --git a/crates/matrix-sdk-sqlite/src/event_cache_store.rs b/crates/matrix-sdk-sqlite/src/event_cache_store.rs index 5aa964cce..3e635a279 100644 --- a/crates/matrix-sdk-sqlite/src/event_cache_store.rs +++ b/crates/matrix-sdk-sqlite/src/event_cache_store.rs @@ -1111,8 +1111,7 @@ impl EventCacheStore for SqliteEventCacheStore { }; let query = format!( - "SELECT content FROM events WHERE relates_to = ? AND room_id = ? {}", - filter_query + "SELECT content FROM events WHERE relates_to = ? AND room_id = ? {filter_query}" ); // Collect related events. diff --git a/crates/matrix-sdk-ui/src/timeline/tests/edit.rs b/crates/matrix-sdk-ui/src/timeline/tests/edit.rs index add39cc3f..90b44ff6d 100644 --- a/crates/matrix-sdk-ui/src/timeline/tests/edit.rs +++ b/crates/matrix-sdk-ui/src/timeline/tests/edit.rs @@ -87,7 +87,7 @@ async fn test_live_sanitized() { let new_html_content = " better message"; timeline .handle_live_event( - f.text_html(format!("* {}", new_plain_content), format!("* {}", new_html_content)) + f.text_html(format!("* {new_plain_content}"), format!("* {new_html_content}")) .sender(&ALICE) .edit( first_event_id, diff --git a/crates/matrix-sdk-ui/tests/integration/timeline/pinned_event.rs b/crates/matrix-sdk-ui/tests/integration/timeline/pinned_event.rs index 477151705..b00871313 100644 --- a/crates/matrix-sdk-ui/tests/integration/timeline/pinned_event.rs +++ b/crates/matrix-sdk-ui/tests/integration/timeline/pinned_event.rs @@ -688,7 +688,7 @@ impl PinnedEventsSync { .into_iter() .map(|id| match EventId::parse(id) { Ok(id) => id, - Err(_) => panic!("Invalid event id: {}", id), + Err(_) => panic!("Invalid event id: {id}"), }) .collect(); diff --git a/crates/matrix-sdk-ui/tests/integration/timeline/thread.rs b/crates/matrix-sdk-ui/tests/integration/timeline/thread.rs index 98a27963c..2fc40bef1 100644 --- a/crates/matrix-sdk-ui/tests/integration/timeline/thread.rs +++ b/crates/matrix-sdk-ui/tests/integration/timeline/thread.rs @@ -151,7 +151,7 @@ async fn test_thread_backpagination() { // events and the thread root assert_eq!(timeline_updates.len(), 5); - println!("Stefan: {:?}", timeline_updates); + println!("Stefan: {timeline_updates:?}"); // Check the timeline diffs assert_let!(VectorDiff::PushFront { value } = &timeline_updates[0]); diff --git a/crates/matrix-sdk/src/sliding_sync/cache.rs b/crates/matrix-sdk/src/sliding_sync/cache.rs index e6c506e6e..6e22996ce 100644 --- a/crates/matrix-sdk/src/sliding_sync/cache.rs +++ b/crates/matrix-sdk/src/sliding_sync/cache.rs @@ -17,7 +17,7 @@ use crate::{sliding_sync::SlidingSyncListCachePolicy, Client, Result}; /// Be careful: as this is used as a storage key; changing it requires migrating /// data! pub(super) fn format_storage_key_prefix(id: &str, user_id: &UserId) -> String { - format!("sliding_sync_store::{}::{}", id, user_id) + format!("sliding_sync_store::{id}::{user_id}") } /// Be careful: as this is used as a storage key; changing it requires migrating diff --git a/crates/matrix-sdk/src/test_utils/mocks/mod.rs b/crates/matrix-sdk/src/test_utils/mocks/mod.rs index 677943941..b72d05715 100644 --- a/crates/matrix-sdk/src/test_utils/mocks/mod.rs +++ b/crates/matrix-sdk/src/test_utils/mocks/mod.rs @@ -2862,20 +2862,17 @@ impl<'a> MockEndpoint<'a, RoomRelationsEndpoint> { match self.endpoint.spec.take() { Some(IncludeRelations::RelationsOfType(rel_type)) => { self.mock = self.mock.and(path_regex(format!( - r"^/_matrix/client/v1/rooms/.*/relations/{}/{}$", - event_spec, rel_type + r"^/_matrix/client/v1/rooms/.*/relations/{event_spec}/{rel_type}$" ))); } Some(IncludeRelations::RelationsOfTypeAndEventType(rel_type, event_type)) => { self.mock = self.mock.and(path_regex(format!( - r"^/_matrix/client/v1/rooms/.*/relations/{}/{}/{}$", - event_spec, rel_type, event_type + r"^/_matrix/client/v1/rooms/.*/relations/{event_spec}/{rel_type}/{event_type}$" ))); } _ => { self.mock = self.mock.and(path_regex(format!( - r"^/_matrix/client/v1/rooms/.*/relations/{}", - event_spec, + r"^/_matrix/client/v1/rooms/.*/relations/{event_spec}", ))); } } diff --git a/crates/matrix-sdk/src/widget/settings/element_call.rs b/crates/matrix-sdk/src/widget/settings/element_call.rs index 4603e1746..cacba712f 100644 --- a/crates/matrix-sdk/src/widget/settings/element_call.rs +++ b/crates/matrix-sdk/src/widget/settings/element_call.rs @@ -271,7 +271,7 @@ impl WidgetSettings { // All the params will be set inside the fragment (to keep the traffic to the // server minimal and most importantly don't send the passwords). - raw_url.set_fragment(Some(&format!("?{}", query))); + raw_url.set_fragment(Some(&format!("?{query}"))); // for EC we always want init on content load to be true. Ok(Self { widget_id: props.widget_id, init_on_content_load: true, raw_url }) @@ -510,9 +510,7 @@ mod tests { for e in expected_elements { assert!( query_set.contains(&e), - "The query elements: \n{:?}\nDid not contain: \n{:?}", - query_set, - e + "The query elements: \n{query_set:?}\nDid not contain: \n{e:?}" ); } } @@ -530,9 +528,7 @@ mod tests { let expected_elements = ("perParticipantE2EE".to_owned(), "false".to_owned()); assert!( query_set.contains(&expected_elements), - "The url query elements for an unencrypted call: \n{:?}\nDid not contain: \n{:?}", - query_set, - expected_elements + "The url query elements for an unencrypted call: \n{query_set:?}\nDid not contain: \n{expected_elements:?}" ); } { @@ -550,9 +546,7 @@ mod tests { for e in expected_elements { assert!( query_set.contains(&e), - "The query elements: \n{:?}\nDid not contain: \n{:?}", - query_set, - e + "The query elements: \n{query_set:?}\nDid not contain: \n{e:?}" ); } } @@ -574,9 +568,7 @@ mod tests { let query_set = get_query_sets(&Url::parse(&url).unwrap()).unwrap().1; assert!( query_set.contains(&controlled_media_element), - "The query elements: \n{:?}\nDid not contain: \n{:?}", - query_set, - controlled_media_element + "The query elements: \n{query_set:?}\nDid not contain: \n{controlled_media_element:?}" ); } } @@ -595,9 +587,7 @@ mod tests { for e in expected_unset_elements { assert!( !query_set.iter().any(|x| x.0 == e), - "The query elements: \n{:?}\nShould not have contained: \n{:?}", - query_set, - e + "The query elements: \n{query_set:?}\nShould not have contained: \n{e:?}" ); } } @@ -615,9 +605,7 @@ mod tests { let expected_elements = ("intent".to_owned(), "join_existing".to_owned()); assert!( query_set.contains(&expected_elements), - "The url query elements for an unencrypted call: \n{:?}\nDid not contain: \n{:?}", - query_set, - expected_elements + "The url query elements for an unencrypted call: \n{query_set:?}\nDid not contain: \n{expected_elements:?}" ); let expected_unset_elements = ["skipLobby".to_owned()]; @@ -625,9 +613,7 @@ mod tests { for e in expected_unset_elements { assert!( !query_set.iter().any(|x| x.0 == e), - "The query elements: \n{:?}\nShould not have contained: \n{:?}", - query_set, - e + "The query elements: \n{query_set:?}\nShould not have contained: \n{e:?}" ); } } @@ -651,9 +637,7 @@ mod tests { for e in expected_elements { assert!( query_set.contains(&e), - "The query elements: \n{:?}\nDid not contain: \n{:?}", - query_set, - e + "The query elements: \n{query_set:?}\nDid not contain: \n{e:?}" ); } } diff --git a/crates/matrix-sdk/tests/integration/encryption/backups.rs b/crates/matrix-sdk/tests/integration/encryption/backups.rs index baef047c7..7d1ea604d 100644 --- a/crates/matrix-sdk/tests/integration/encryption/backups.rs +++ b/crates/matrix-sdk/tests/integration/encryption/backups.rs @@ -1557,7 +1557,7 @@ async fn mock_get_event( } }); Mock::given(method("GET")) - .and(path(format!("_matrix/client/r0/rooms/{}/event/{}", room_id, event_id))) + .and(path(format!("_matrix/client/r0/rooms/{room_id}/event/{event_id}"))) .and(header("authorization", "Bearer 1234")) .respond_with(ResponseTemplate::new(200).set_body_json(event_json)) .expect(2) diff --git a/crates/matrix-sdk/tests/integration/widget.rs b/crates/matrix-sdk/tests/integration/widget.rs index b9d2d6e1a..14283f1a7 100644 --- a/crates/matrix-sdk/tests/integration/widget.rs +++ b/crates/matrix-sdk/tests/integration/widget.rs @@ -102,7 +102,7 @@ async fn send_request( "action": action, "data": data, }); - println!("Json string sent from the widget {}", json_string); + println!("Json string sent from the widget {json_string}"); let sent = driver_handle.send(json_string).await; assert!(sent); } @@ -772,7 +772,7 @@ async fn test_update_delayed_event() { .await; // Receive the response let response = recv_message(&driver_handle).await; - print!("{:?}", response); + print!("{response:?}"); assert_eq!(response["api"], "fromWidget"); assert_eq!(response["action"], "org.matrix.msc4157.update_delayed_event"); let empty_response = response["response"].clone(); @@ -797,7 +797,7 @@ async fn test_try_update_delayed_event_without_permission() { .await; // Receive the response let response = recv_message(&driver_handle).await; - print!("{:?}", response); + print!("{response:?}"); assert_eq!(response["api"], "fromWidget"); assert_eq!(response["action"], "org.matrix.msc4157.update_delayed_event"); let error_response = response["response"]["error"]["message"].clone(); diff --git a/labs/multiverse/src/widgets/room_list.rs b/labs/multiverse/src/widgets/room_list.rs index 53c03a930..a62f6104a 100644 --- a/labs/multiverse/src/widgets/room_list.rs +++ b/labs/multiverse/src/widgets/room_list.rs @@ -197,7 +197,7 @@ impl Widget for &mut RoomList { room_id.to_string() }; - format!("#{i}{dm_marker} {}", room_name) + format!("#{i}{dm_marker} {room_name}") }; let line = Line::styled(line, TEXT_COLOR); diff --git a/labs/multiverse/src/widgets/room_view/timeline.rs b/labs/multiverse/src/widgets/room_view/timeline.rs index e7d1651f4..f22a4853e 100644 --- a/labs/multiverse/src/widgets/room_view/timeline.rs +++ b/labs/multiverse/src/widgets/room_view/timeline.rs @@ -45,12 +45,12 @@ impl Widget for &mut TimelineView<'_> { TimelineItemContent::MsgLike(MsgLikeContent { kind: MsgLikeKind::Redacted, .. - }) => content.push(format!("{}: -- redacted --", sender)), + }) => content.push(format!("{sender}: -- redacted --")), TimelineItemContent::MsgLike(MsgLikeContent { kind: MsgLikeKind::UnableToDecrypt(_), .. - }) => content.push(format!("{}: (UTD)", sender)), + }) => content.push(format!("{sender}: (UTD)")), TimelineItemContent::MembershipChange(m) => { if let Some(change) = m.change() { diff --git a/testing/matrix-sdk-integration-testing/src/tests/room_directory_search.rs b/testing/matrix-sdk-integration-testing/src/tests/room_directory_search.rs index b6c20a665..79f240183 100644 --- a/testing/matrix-sdk-integration-testing/src/tests/room_directory_search.rs +++ b/testing/matrix-sdk-integration-testing/src/tests/room_directory_search.rs @@ -37,7 +37,7 @@ async fn test_room_directory_search_filter() -> Result<()> { for index in 0..25 { let mut request: CreateRoomRequest = CreateRoomRequest::new(); request.visibility = Visibility::Public; - let name = format!("{}_{}", search_string, index); + let name = format!("{search_string}_{index}"); warn!("room name: {}", name); request.name = Some(name); alice.create_room(request).await?; diff --git a/testing/matrix-sdk-integration-testing/src/tests/room_privacy.rs b/testing/matrix-sdk-integration-testing/src/tests/room_privacy.rs index 71b6e736d..6b1a24799 100644 --- a/testing/matrix-sdk-integration-testing/src/tests/room_privacy.rs +++ b/testing/matrix-sdk-integration-testing/src/tests/room_privacy.rs @@ -172,7 +172,7 @@ async fn test_removing_published_room_alias() -> anyhow::Result<()> { // We'll add a room alias to it let random_id: u128 = random(); - let local_part_room_alias = format!("a-room-alias-{}", random_id); + let local_part_room_alias = format!("a-room-alias-{random_id}"); let raw_room_alias = format!("#{local_part_room_alias}:{server_name}"); let room_alias = RoomAliasId::parse(raw_room_alias).expect("The room alias should be valid");