use/enable let_underscore_must_use lint

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-05-23 01:27:04 -04:00 committed by June 🍓🦴
parent 71bdcb958a
commit 32161801ed
15 changed files with 91 additions and 74 deletions

View file

@ -1,4 +1,4 @@
use std::fmt::Write as _;
use std::fmt::Write;
use ruma::{events::room::message::RoomMessageEventContent, OwnedRoomId, RoomId, ServerName, UserId};
@ -20,7 +20,8 @@ pub(crate) async fn incoming_federeation(_body: Vec<&str>) -> Result<RoomMessage
for (r, (e, i)) in map.iter() {
let elapsed = i.elapsed();
let _ = writeln!(msg, "{} {}: {}m{}s", r, e, elapsed.as_secs() / 60, elapsed.as_secs() % 60);
writeln!(msg, "{} {}: {}m{}s", r, e, elapsed.as_secs() / 60, elapsed.as_secs() % 60,)
.expect("should be able to write to string buffer");
}
Ok(RoomMessageEventContent::text_plain(&msg))
}
@ -120,7 +121,7 @@ pub(crate) async fn remote_user_in_rooms(_body: Vec<&str>, user_id: Box<UserId>)
members,
escape_html(name)
)
.unwrap();
.expect("should be able to write to string buffer");
output
})
);

View file

@ -1,4 +1,4 @@
use std::fmt::Write as _;
use std::fmt::Write;
use ruma::{events::room::message::RoomMessageEventContent, RoomAliasId};
@ -79,12 +79,13 @@ pub(crate) async fn process(command: RoomAliasCommand, _body: Vec<&str>) -> Resu
match aliases {
Ok(aliases) => {
let plain_list = aliases.iter().fold(String::new(), |mut output, alias| {
writeln!(output, "- {alias}").unwrap();
writeln!(output, "- {alias}").expect("should be able to write to string buffer");
output
});
let html_list = aliases.iter().fold(String::new(), |mut output, alias| {
writeln!(output, "<li>{}</li>", escape_html(alias.as_ref())).unwrap();
writeln!(output, "<li>{}</li>", escape_html(alias.as_ref()))
.expect("should be able to write to string buffer");
output
});
@ -106,7 +107,8 @@ pub(crate) async fn process(command: RoomAliasCommand, _body: Vec<&str>) -> Resu
let plain_list = aliases
.iter()
.fold(String::new(), |mut output, (alias, id)| {
writeln!(output, "- `{alias}` -> #{id}:{server_name}").unwrap();
writeln!(output, "- `{alias}` -> #{id}:{server_name}")
.expect("should be able to write to string buffer");
output
});
@ -120,7 +122,7 @@ pub(crate) async fn process(command: RoomAliasCommand, _body: Vec<&str>) -> Resu
escape_html(id.as_ref()),
server_name
)
.unwrap();
.expect("should be able to write to string buffer");
output
});

View file

@ -1,4 +1,4 @@
use std::fmt::Write as _;
use std::fmt::Write;
use ruma::{events::room::message::RoomMessageEventContent, OwnedRoomId};
@ -48,7 +48,7 @@ pub(crate) async fn list(_body: Vec<&str>, page: Option<usize>) -> Result<RoomMe
members,
escape_html(name)
)
.unwrap();
.expect("should be able to write to string buffer");
output
})
);

View file

@ -1,4 +1,4 @@
use std::fmt::Write as _;
use std::fmt::Write;
use ruma::{events::room::message::RoomMessageEventContent, OwnedRoomId};
@ -65,7 +65,7 @@ pub(crate) async fn process(command: RoomDirectoryCommand, _body: Vec<&str>) ->
members,
escape_html(name.as_ref())
)
.unwrap();
.expect("should be able to write to string buffer");
output
})
);

View file

@ -122,7 +122,9 @@ pub(crate) async fn process(command: RoomModerationCommand, body: Vec<&str>) ->
&local_user, &room_id
);
_ = leave_room(&local_user, &room_id, None).await;
if let Err(e) = leave_room(&local_user, &room_id, None).await {
warn!(%e, "Failed to leave room");
}
}
} else {
for local_user in services()
@ -329,7 +331,9 @@ pub(crate) async fn process(command: RoomModerationCommand, body: Vec<&str>) ->
admins too)",
&local_user, room_id
);
_ = leave_room(&local_user, &room_id, None).await;
if let Err(e) = leave_room(&local_user, &room_id, None).await {
warn!(%e, "Failed to leave room");
}
}
} else {
for local_user in services()

View file

@ -65,7 +65,8 @@ pub(crate) async fn create(
.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()