fix needless collect
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
dfd13780df
commit
5722c4ae39
5 changed files with 10 additions and 20 deletions
|
@ -730,7 +730,6 @@ nursery = "warn"
|
||||||
|
|
||||||
## some sadness
|
## some sadness
|
||||||
missing_const_for_fn = { level = "allow", priority = 1 } # TODO
|
missing_const_for_fn = { level = "allow", priority = 1 } # TODO
|
||||||
needless_collect = { level = "allow", priority = 1 } # TODO
|
|
||||||
option_if_let_else = { level = "allow", priority = 1 } # TODO
|
option_if_let_else = { level = "allow", priority = 1 } # TODO
|
||||||
redundant_pub_crate = { level = "allow", priority = 1 } # TODO
|
redundant_pub_crate = { level = "allow", priority = 1 } # TODO
|
||||||
significant_drop_in_scrutinee = { level = "allow", priority = 1 } # TODO
|
significant_drop_in_scrutinee = { level = "allow", priority = 1 } # TODO
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
use api::client::leave_room;
|
use api::client::leave_room;
|
||||||
use ruma::{
|
use ruma::{events::room::message::RoomMessageEventContent, OwnedRoomId, RoomAliasId, RoomId, RoomOrAliasId};
|
||||||
events::room::message::RoomMessageEventContent, OwnedRoomId, OwnedUserId, RoomAliasId, RoomId, RoomOrAliasId,
|
|
||||||
};
|
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
|
|
||||||
use super::{super::Service, RoomModerationCommand};
|
use super::{super::Service, RoomModerationCommand};
|
||||||
|
@ -124,9 +122,7 @@ async fn ban_room(
|
||||||
.is_admin(local_user)
|
.is_admin(local_user)
|
||||||
.unwrap_or(true))
|
.unwrap_or(true))
|
||||||
})
|
})
|
||||||
})
|
}) {
|
||||||
.collect::<Vec<OwnedUserId>>()
|
|
||||||
{
|
|
||||||
debug!(
|
debug!(
|
||||||
"Attempting leave for user {} in room {} (forced, ignoring all errors, evicting admins too)",
|
"Attempting leave for user {} in room {} (forced, ignoring all errors, evicting admins too)",
|
||||||
&local_user, &room_id
|
&local_user, &room_id
|
||||||
|
@ -153,9 +149,7 @@ async fn ban_room(
|
||||||
.is_admin(local_user)
|
.is_admin(local_user)
|
||||||
.unwrap_or(false))
|
.unwrap_or(false))
|
||||||
})
|
})
|
||||||
})
|
}) {
|
||||||
.collect::<Vec<OwnedUserId>>()
|
|
||||||
{
|
|
||||||
debug!("Attempting leave for user {} in room {}", &local_user, &room_id);
|
debug!("Attempting leave for user {} in room {}", &local_user, &room_id);
|
||||||
if let Err(e) = leave_room(&local_user, &room_id, None).await {
|
if let Err(e) = leave_room(&local_user, &room_id, None).await {
|
||||||
error!(
|
error!(
|
||||||
|
@ -335,9 +329,7 @@ async fn ban_list_of_rooms(body: Vec<&str>, force: bool, disable_federation: boo
|
||||||
.is_admin(local_user)
|
.is_admin(local_user)
|
||||||
.unwrap_or(true))
|
.unwrap_or(true))
|
||||||
})
|
})
|
||||||
})
|
}) {
|
||||||
.collect::<Vec<OwnedUserId>>()
|
|
||||||
{
|
|
||||||
debug!(
|
debug!(
|
||||||
"Attempting leave for user {} in room {} (forced, ignoring all errors, evicting admins too)",
|
"Attempting leave for user {} in room {} (forced, ignoring all errors, evicting admins too)",
|
||||||
&local_user, room_id
|
&local_user, room_id
|
||||||
|
@ -364,9 +356,7 @@ async fn ban_list_of_rooms(body: Vec<&str>, force: bool, disable_federation: boo
|
||||||
.is_admin(local_user)
|
.is_admin(local_user)
|
||||||
.unwrap_or(false))
|
.unwrap_or(false))
|
||||||
})
|
})
|
||||||
})
|
}) {
|
||||||
.collect::<Vec<OwnedUserId>>()
|
|
||||||
{
|
|
||||||
debug!("Attempting leave for user {} in room {}", &local_user, &room_id);
|
debug!("Attempting leave for user {} in room {}", &local_user, &room_id);
|
||||||
if let Err(e) = leave_room(&local_user, &room_id, None).await {
|
if let Err(e) = leave_room(&local_user, &room_id, None).await {
|
||||||
error!(
|
error!(
|
||||||
|
|
|
@ -1682,8 +1682,7 @@ async fn remote_leave_room(user_id: &UserId, room_id: &RoomId) -> Result<()> {
|
||||||
.filter_map(|event: serde_json::Value| event.get("sender").cloned())
|
.filter_map(|event: serde_json::Value| event.get("sender").cloned())
|
||||||
.filter_map(|sender| sender.as_str().map(ToOwned::to_owned))
|
.filter_map(|sender| sender.as_str().map(ToOwned::to_owned))
|
||||||
.filter_map(|sender| UserId::parse(sender).ok())
|
.filter_map(|sender| UserId::parse(sender).ok())
|
||||||
.map(|user| user.server_name().to_owned())
|
.map(|user| user.server_name().to_owned()),
|
||||||
.collect::<HashSet<OwnedServerName>>(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
debug!("servers in remote_leave_room: {servers:?}");
|
debug!("servers in remote_leave_room: {servers:?}");
|
||||||
|
|
|
@ -319,7 +319,9 @@ impl Data {
|
||||||
|
|
||||||
/// Returns an iterator of all joined members of a room.
|
/// Returns an iterator of all joined members of a room.
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub(super) fn room_members<'a>(&'a self, room_id: &RoomId) -> Box<dyn Iterator<Item = Result<OwnedUserId>> + 'a> {
|
pub(super) fn room_members<'a>(
|
||||||
|
&'a self, room_id: &RoomId,
|
||||||
|
) -> Box<dyn Iterator<Item = Result<OwnedUserId>> + Send + 'a> {
|
||||||
let mut prefix = room_id.as_bytes().to_vec();
|
let mut prefix = room_id.as_bytes().to_vec();
|
||||||
prefix.push(0xFF);
|
prefix.push(0xFF);
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ impl Service {
|
||||||
|
|
||||||
/// Returns an iterator over all joined members of a room.
|
/// Returns an iterator over all joined members of a room.
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub fn room_members(&self, room_id: &RoomId) -> impl Iterator<Item = Result<OwnedUserId>> + '_ {
|
pub fn room_members(&self, room_id: &RoomId) -> impl Iterator<Item = Result<OwnedUserId>> + Send + '_ {
|
||||||
self.db.room_members(room_id)
|
self.db.room_members(room_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue