use/enable let_underscore_must_use
lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
71bdcb958a
commit
32161801ed
15 changed files with 91 additions and 74 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::fmt::Write as _;
|
||||
use std::fmt::Write;
|
||||
|
||||
use register::RegistrationKind;
|
||||
use ruma::{
|
||||
|
@ -241,7 +241,8 @@ pub(crate) async fn register_route(body: Ruma<register::v3::Request>) -> Result<
|
|||
// If `new_user_displayname_suffix` is set, registration will push whatever
|
||||
// content is set to the user's display name with a space before it
|
||||
if !services().globals.new_user_displayname_suffix().is_empty() {
|
||||
_ = write!(displayname, " {}", services().globals.config.new_user_displayname_suffix);
|
||||
write!(displayname, " {}", services().globals.config.new_user_displayname_suffix)
|
||||
.expect("should be able to write to string buffer");
|
||||
}
|
||||
|
||||
services()
|
||||
|
|
|
@ -80,7 +80,9 @@ async fn banned_room_check(user_id: &UserId, room_id: Option<&RoomId>, server_na
|
|||
|
||||
// ignore errors
|
||||
leave_all_rooms(user_id).await;
|
||||
_ = services().users.deactivate_account(user_id);
|
||||
if let Err(e) = services().users.deactivate_account(user_id) {
|
||||
warn!(%e, "Failed to deactivate account");
|
||||
}
|
||||
}
|
||||
|
||||
return Err(Error::BadRequest(
|
||||
|
@ -115,7 +117,9 @@ async fn banned_room_check(user_id: &UserId, room_id: Option<&RoomId>, server_na
|
|||
|
||||
// ignore errors
|
||||
leave_all_rooms(user_id).await;
|
||||
_ = services().users.deactivate_account(user_id);
|
||||
if let Err(e) = services().users.deactivate_account(user_id) {
|
||||
warn!(%e, "Failed to deactivate account");
|
||||
}
|
||||
}
|
||||
|
||||
return Err(Error::BadRequest(
|
||||
|
@ -1548,8 +1552,12 @@ pub async fn leave_all_rooms(user_id: &UserId) {
|
|||
};
|
||||
|
||||
// ignore errors
|
||||
_ = services().rooms.state_cache.forget(&room_id, user_id);
|
||||
_ = leave_room(user_id, &room_id, None).await;
|
||||
if let Err(e) = services().rooms.state_cache.forget(&room_id, user_id) {
|
||||
warn!(%e, "Failed to forget room");
|
||||
}
|
||||
if let Err(e) = leave_room(user_id, &room_id, None).await {
|
||||
warn!(%e, "Failed to leave room");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use ruma::{
|
|||
presence::PresenceState,
|
||||
};
|
||||
use serde_json::value::to_raw_value;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{
|
||||
service::{pdu::PduBuilder, user_is_local},
|
||||
|
@ -82,11 +83,14 @@ pub(crate) async fn set_displayname_route(
|
|||
);
|
||||
let state_lock = mutex_state.lock().await;
|
||||
|
||||
_ = services()
|
||||
if let Err(e) = services()
|
||||
.rooms
|
||||
.timeline
|
||||
.build_and_append_pdu(pdu_builder, sender_user, &room_id, &state_lock)
|
||||
.await;
|
||||
.await
|
||||
{
|
||||
warn!(%e, "Failed to update/send new display name in room");
|
||||
}
|
||||
}
|
||||
|
||||
if services().globals.allow_local_presence() {
|
||||
|
@ -224,11 +228,14 @@ pub(crate) async fn set_avatar_url_route(
|
|||
);
|
||||
let state_lock = mutex_state.lock().await;
|
||||
|
||||
_ = services()
|
||||
if let Err(e) = services()
|
||||
.rooms
|
||||
.timeline
|
||||
.build_and_append_pdu(pdu_builder, sender_user, &room_id, &state_lock)
|
||||
.await;
|
||||
.await
|
||||
{
|
||||
warn!(%e, "Failed to set/update room with new avatar URL / pfp");
|
||||
}
|
||||
}
|
||||
|
||||
if services().globals.allow_local_presence() {
|
||||
|
|
|
@ -388,7 +388,7 @@ pub(crate) async fn create_room_route(body: Ruma<create_room::v3::Request>) -> R
|
|||
Error::BadRequest(ErrorKind::InvalidParam, "Invalid initial state event.")
|
||||
})?;
|
||||
|
||||
debug_warn!("initial state event: {event:?}");
|
||||
debug_info!("Room creation initial state event: {event:?}");
|
||||
|
||||
// client/appservice workaround: if a user sends an initial_state event with a
|
||||
// state event in there with the content of literally `{}` (not null or empty
|
||||
|
@ -460,7 +460,9 @@ pub(crate) async fn create_room_route(body: Ruma<create_room::v3::Request>) -> R
|
|||
// 8. Events implied by invite (and TODO: invite_3pid)
|
||||
drop(state_lock);
|
||||
for user_id in &body.invite {
|
||||
_ = invite_helper(sender_user, user_id, &room_id, None, body.is_direct).await;
|
||||
if let Err(e) = invite_helper(sender_user, user_id, &room_id, None, body.is_direct).await {
|
||||
warn!(%e, "Failed to send invite");
|
||||
}
|
||||
}
|
||||
|
||||
// Homeserver specific stuff
|
||||
|
@ -815,7 +817,7 @@ pub(crate) async fn upgrade_room_route(body: Ruma<upgrade_room::v3::Request>) ->
|
|||
|
||||
// Modify the power levels in the old room to prevent sending of events and
|
||||
// inviting new users
|
||||
_ = services()
|
||||
services()
|
||||
.rooms
|
||||
.timeline
|
||||
.build_and_append_pdu(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue