Handle another new clippy lint

Issue about false positives:
https://github.com/rust-lang/rust-clippy/issues/10482
This commit is contained in:
Jonas Platte
2023-03-11 12:45:09 +01:00
committed by Jonas Platte
parent 595e34aad5
commit 8d83a996a6
7 changed files with 10 additions and 5 deletions

View File

@@ -147,7 +147,7 @@ impl AuthenticationService {
})
.map_err(AuthenticationError::from)?;
let details = RUNTIME.block_on(async { self.details_from_client(&client).await })?;
let details = RUNTIME.block_on(self.details_from_client(&client))?;
// Now we've verified that it's a valid homeserver, make sure
// there's a sliding sync proxy available one way or another.

View File

@@ -377,7 +377,8 @@ impl Client {
impl Client {
/// The homeserver this client is configured to use.
pub fn homeserver(&self) -> String {
RUNTIME.block_on(async move { self.async_homeserver().await })
#[allow(unknown_lints, clippy::redundant_async_block)] // false positive
RUNTIME.block_on(self.async_homeserver())
}
pub fn rooms(&self) -> Vec<Arc<Room>> {

View File

@@ -250,7 +250,8 @@ impl Room {
.unwrap()
.get_or_insert_with(|| {
let room = self.room.clone();
let timeline = RUNTIME.block_on(async move { room.timeline().await });
#[allow(unknown_lints, clippy::redundant_async_block)] // false positive
let timeline = RUNTIME.block_on(room.timeline());
Arc::new(timeline)
})
.clone();

View File

@@ -194,8 +194,8 @@ impl SlidingSyncRoom {
}
};
let (timeline_items, timeline_stream) =
RUNTIME.block_on(async { timeline.subscribe().await });
#[allow(unknown_lints, clippy::redundant_async_block)] // false positive
let (timeline_items, timeline_stream) = RUNTIME.block_on(timeline.subscribe());
let handle_events = async move {
let listener: Arc<dyn TimelineListener> = listener.into();

View File

@@ -1066,6 +1066,7 @@ pub(crate) mod tests {
let listener = manager.listen_for_received_queries();
#[allow(unknown_lints, clippy::redundant_async_block)] // false positive
let task = tokio::task::spawn(async move { listener.wait(Duration::from_secs(10)).await });
manager

View File

@@ -543,6 +543,7 @@ async fn fetch_members_deduplication() {
// Create N tasks that try to fetch the members.
for _ in 0..5 {
#[allow(unknown_lints, clippy::redundant_async_block)] // false positive
let task = tokio::spawn({
let room = room.clone();
async move { room.sync_members().await }

View File

@@ -180,6 +180,7 @@ async fn echo() {
// Don't move the original timeline, it must live until the end of the test
let timeline = timeline.clone();
#[allow(unknown_lints, clippy::redundant_async_block)] // false positive
let send_hdl = spawn(async move {
timeline
.send(RoomMessageEventContent::text_plain("Hello, World!").into(), Some(txn_id))