Skip to content

Commit caa71fa

Browse files
committed
chore(ui): Upgrade to Rust edition 2024
1 parent e896677 commit caa71fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+369
-372
lines changed

crates/matrix-sdk-ui/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "matrix-sdk-ui"
33
description = "GUI-centric utilities on top of matrix-rust-sdk (experimental)."
44
version = "0.13.0"
5-
edition = "2021"
5+
edition = "2024"
66
repository = "https://github.com/matrix-org/matrix-rust-sdk"
77
license = "Apache-2.0"
88
rust-version.workspace = true

crates/matrix-sdk-ui/src/encryption_sync_service.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ use std::{pin::Pin, time::Duration};
3030

3131
use async_stream::stream;
3232
use futures_core::stream::Stream;
33-
use futures_util::{pin_mut, StreamExt};
34-
use matrix_sdk::{sleep::sleep, Client, SlidingSync, LEASE_DURATION_MS};
33+
use futures_util::{StreamExt, pin_mut};
34+
use matrix_sdk::{Client, LEASE_DURATION_MS, SlidingSync, sleep::sleep};
3535
use ruma::{api::client::sync::sync_events::v5 as http, assign};
3636
use tokio::sync::OwnedMutexGuard;
37-
use tracing::{debug, instrument, trace, Span};
37+
use tracing::{Span, debug, instrument, trace};
3838

3939
/// Unit type representing a permit to *use* an [`EncryptionSyncService`].
4040
///
@@ -66,11 +66,7 @@ pub enum WithLocking {
6666

6767
impl From<bool> for WithLocking {
6868
fn from(value: bool) -> Self {
69-
if value {
70-
Self::Yes
71-
} else {
72-
Self::No
73-
}
69+
if value { Self::Yes } else { Self::No }
7470
}
7571
}
7672

@@ -130,7 +126,7 @@ impl EncryptionSyncService {
130126
// Any other error is fatal
131127
return Err(Error::ClientError(err));
132128
}
133-
};
129+
}
134130
}
135131

136132
Ok(Self { client, sliding_sync, with_locking })

crates/matrix-sdk-ui/src/notification_client.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,39 @@ use std::{
1818
time::Duration,
1919
};
2020

21-
use futures_util::{pin_mut, StreamExt as _};
21+
use futures_util::{StreamExt as _, pin_mut};
2222
use matrix_sdk::{
23-
room::Room, sleep::sleep, Client, ClientBuildError, SlidingSyncList, SlidingSyncMode,
23+
Client, ClientBuildError, SlidingSyncList, SlidingSyncMode, room::Room, sleep::sleep,
2424
};
25-
use matrix_sdk_base::{deserialized_responses::TimelineEvent, RoomState, StoreError};
25+
use matrix_sdk_base::{RoomState, StoreError, deserialized_responses::TimelineEvent};
2626
use ruma::{
27+
EventId, OwnedEventId, OwnedRoomId, RoomId, UserId,
2728
api::client::sync::sync_events::v5 as http,
2829
assign,
2930
directory::RoomTypeFilter,
3031
events::{
32+
AnyFullStateEventContent, AnyMessageLikeEventContent, AnyStateEvent,
33+
AnySyncMessageLikeEvent, AnySyncTimelineEvent, FullStateEventContent, StateEventType,
34+
TimelineEventType,
3135
room::{
3236
join_rules::JoinRule,
3337
member::{MembershipState, StrippedRoomMemberEvent},
3438
message::{Relation, SyncRoomMessageEvent},
3539
},
36-
AnyFullStateEventContent, AnyMessageLikeEventContent, AnyStateEvent,
37-
AnySyncMessageLikeEvent, AnySyncTimelineEvent, FullStateEventContent, StateEventType,
38-
TimelineEventType,
3940
},
4041
html::RemoveReplyFallback,
4142
push::Action,
4243
serde::Raw,
43-
uint, EventId, OwnedEventId, OwnedRoomId, RoomId, UserId,
44+
uint,
4445
};
4546
use thiserror::Error;
4647
use tokio::sync::Mutex as AsyncMutex;
4748
use tracing::{debug, info, instrument, trace, warn};
4849

4950
use crate::{
51+
DEFAULT_SANITIZER_MODE,
5052
encryption_sync_service::{EncryptionSyncPermit, EncryptionSyncService, WithLocking},
5153
sync_service::SyncService,
52-
DEFAULT_SANITIZER_MODE,
5354
};
5455

5556
/// What kind of process setup do we have for this notification client?

crates/matrix-sdk-ui/src/room_list_service/filters/fuzzy_match_room_name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
pub use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher as _};
15+
pub use fuzzy_matcher::{FuzzyMatcher as _, skim::SkimMatcherV2};
1616

17-
use super::{normalize_string, Filter};
17+
use super::{Filter, normalize_string};
1818

1919
struct FuzzyMatcher {
2020
matcher: SkimMatcherV2,

crates/matrix-sdk-ui/src/room_list_service/filters/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//!
2222
//! ```rust
2323
//! use matrix_sdk_ui::room_list_service::{
24-
//! filters, RoomListDynamicEntriesController,
24+
//! RoomListDynamicEntriesController, filters,
2525
//! };
2626
//!
2727
//! fn configure_room_list(
@@ -67,7 +67,7 @@ mod unread;
6767

6868
pub use all::new_filter as new_filter_all;
6969
pub use any::new_filter as new_filter_any;
70-
pub use category::{new_filter as new_filter_category, RoomCategory};
70+
pub use category::{RoomCategory, new_filter as new_filter_category};
7171
pub use deduplicate_versions::new_filter as new_filter_deduplicate_versions;
7272
pub use favourite::new_filter as new_filter_favourite;
7373
pub use fuzzy_match_room_name::new_filter as new_filter_fuzzy_match_room_name;
@@ -84,12 +84,12 @@ pub use normalized_match_room_name::new_filter as new_filter_normalized_match_ro
8484
pub use not::new_filter as new_filter_not;
8585
#[cfg(test)]
8686
use ruma::RoomId;
87-
use unicode_normalization::{char::is_combining_mark, UnicodeNormalization};
87+
use unicode_normalization::{UnicodeNormalization, char::is_combining_mark};
8888
pub use unread::new_filter as new_filter_unread;
8989
#[cfg(test)]
9090
use wiremock::{
91-
matchers::{header, method, path},
9291
Mock, MockServer, ResponseTemplate,
92+
matchers::{header, method, path},
9393
};
9494

9595
/// A trait “alias” that represents a _filter_.

crates/matrix-sdk-ui/src/room_list_service/filters/normalized_match_room_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use tracing::error;
1616

17-
use super::{normalize_string, Filter};
17+
use super::{Filter, normalize_string};
1818

1919
struct NormalizedMatcher {
2020
pattern: Option<String>,

crates/matrix-sdk-ui/src/room_list_service/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ use std::{sync::Arc, time::Duration};
6060

6161
use async_stream::stream;
6262
use eyeball::Subscriber;
63-
use futures_util::{pin_mut, Stream, StreamExt};
63+
use futures_util::{Stream, StreamExt, pin_mut};
6464
use matrix_sdk::{
65-
event_cache::EventCacheError, timeout::timeout, Client, Error as SlidingSyncError, Room,
66-
SlidingSync, SlidingSyncList, SlidingSyncMode,
65+
Client, Error as SlidingSyncError, Room, SlidingSync, SlidingSyncList, SlidingSyncMode,
66+
event_cache::EventCacheError, timeout::timeout,
6767
};
6868
pub use room_list::*;
6969
use ruma::{
70-
api::client::sync::sync_events::v5 as http, assign, directory::RoomTypeFilter,
71-
events::StateEventType, OwnedRoomId, RoomId, UInt,
70+
OwnedRoomId, RoomId, UInt, api::client::sync::sync_events::v5 as http, assign,
71+
directory::RoomTypeFilter, events::StateEventType,
7272
};
7373
pub use state::*;
7474
use thiserror::Error;
@@ -501,16 +501,16 @@ pub enum SyncIndicator {
501501
mod tests {
502502
use std::future::ready;
503503

504-
use futures_util::{pin_mut, StreamExt};
504+
use futures_util::{StreamExt, pin_mut};
505505
use matrix_sdk::{
506-
config::RequestConfig, test_utils::client::mock_matrix_session, Client, SlidingSyncMode,
506+
Client, SlidingSyncMode, config::RequestConfig, test_utils::client::mock_matrix_session,
507507
};
508508
use matrix_sdk_test::async_test;
509509
use ruma::api::MatrixVersion;
510510
use serde_json::json;
511-
use wiremock::{http::Method, Match, Mock, MockServer, Request, ResponseTemplate};
511+
use wiremock::{Match, Mock, MockServer, Request, ResponseTemplate, http::Method};
512512

513-
use super::{Error, RoomListService, State, ALL_ROOMS_LIST_NAME};
513+
use super::{ALL_ROOMS_LIST_NAME, Error, RoomListService, State};
514514

515515
async fn new_client() -> (Client, MockServer) {
516516
let session = mock_matrix_session();

crates/matrix-sdk-ui/src/room_list_service/room_list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use async_stream::stream;
2020
use eyeball::{SharedObservable, Subscriber};
2121
use eyeball_im::{Vector, VectorDiff};
2222
use eyeball_im_util::vector::VectorObserverExt;
23-
use futures_util::{pin_mut, stream, Stream, StreamExt as _};
23+
use futures_util::{Stream, StreamExt as _, pin_mut, stream};
2424
use matrix_sdk::{
25-
executor::{spawn, JoinHandle},
2625
Client, SlidingSync, SlidingSyncList,
26+
executor::{JoinHandle, spawn},
2727
};
2828
use matrix_sdk_base::RoomInfoNotableUpdate;
2929
use tokio::{
@@ -33,9 +33,9 @@ use tokio::{
3333
use tracing::{error, trace};
3434

3535
use super::{
36+
Error, Room, State,
3637
filters::BoxedFilterFn,
3738
sorters::{new_sorter_lexicographic, new_sorter_name, new_sorter_recency},
38-
Error, Room, State,
3939
};
4040

4141
/// A `RoomList` represents a list of rooms, from a

crates/matrix-sdk-ui/src/room_list_service/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use std::{future::ready, sync::Mutex};
1818

1919
use eyeball::{SharedObservable, Subscriber};
20-
use matrix_sdk::{sliding_sync::Range, SlidingSync, SlidingSyncMode};
20+
use matrix_sdk::{SlidingSync, SlidingSyncMode, sliding_sync::Range};
2121
use ruma::time::{Duration, Instant};
2222

2323
use super::Error;

crates/matrix-sdk-ui/src/sync_service.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,22 @@ use std::{sync::Arc, time::Duration};
2828

2929
use eyeball::{SharedObservable, Subscriber};
3030
use futures_util::{
31-
future::{select, Either},
32-
pin_mut, StreamExt as _,
31+
StreamExt as _,
32+
future::{Either, select},
33+
pin_mut,
3334
};
3435
use matrix_sdk::{
36+
Client,
3537
config::RequestConfig,
36-
executor::{spawn, JoinHandle},
38+
executor::{JoinHandle, spawn},
3739
sleep::sleep,
38-
Client,
3940
};
4041
use thiserror::Error;
4142
use tokio::sync::{
42-
mpsc::{Receiver, Sender},
4343
Mutex as AsyncMutex, OwnedMutexGuard,
44+
mpsc::{Receiver, Sender},
4445
};
45-
use tracing::{error, info, instrument, trace, warn, Instrument, Level, Span};
46+
use tracing::{Instrument, Level, Span, error, info, instrument, trace, warn};
4647

4748
use crate::{
4849
encryption_sync_service::{self, EncryptionSyncPermit, EncryptionSyncService, WithLocking},

0 commit comments

Comments
 (0)