enable unused_async lint

This also caused a "new" `unnecessary_wraps` lint to fire too, so that
got fixed too.
This commit is contained in:
Charles Hall 2024-05-14 19:28:36 -07:00
parent 4419e855ae
commit f855bd09d1
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
3 changed files with 11 additions and 10 deletions

View file

@ -90,6 +90,7 @@ unneeded_field_pattern = "warn"
unnested_or_patterns = "warn"
unreadable_literal = "warn"
unseparated_literal_suffix = "warn"
unused_async = "warn"
verbose_file_reads = "warn"
wildcard_dependencies = "warn"

View file

@ -599,12 +599,12 @@ async fn join_room_by_id_helper(
.collect::<Vec<_>>()
{
if user.server_name() == services().globals.server_name()
&& services()
.rooms
.state_accessor
.user_can_invite(room_id, &user, sender_user, &state_lock)
.await
.unwrap_or(false)
&& services().rooms.state_accessor.user_can_invite(
room_id,
&user,
sender_user,
&state_lock,
)
{
auth_user = Some(user);
break;

View file

@ -310,13 +310,13 @@ impl Service {
})
}
pub(crate) async fn user_can_invite(
pub(crate) fn user_can_invite(
&self,
room_id: &RoomId,
sender: &UserId,
target_user: &UserId,
state_lock: &MutexGuard<'_, ()>,
) -> Result<bool> {
) -> bool {
let content = to_raw_value(&RoomMemberEventContent::new(MembershipState::Invite))
.expect("Event content always serializes");
@ -328,11 +328,11 @@ impl Service {
redacts: None,
};
Ok(services()
services()
.rooms
.timeline
.create_hash_and_sign_event(new_event, sender, room_id, state_lock)
.is_ok())
.is_ok()
}
pub(crate) fn get_member(