enable redundant_closure_for_method_calls lint

This commit is contained in:
Charles Hall 2024-05-14 18:59:24 -07:00
parent a636405bed
commit 96e1877639
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
37 changed files with 85 additions and 88 deletions

View file

@ -434,9 +434,7 @@ impl Service {
// The original create event must be in the auth events
if !matches!(
auth_events
.get(&(StateEventType::RoomCreate, String::new()))
.map(|a| a.as_ref()),
auth_events.get(&(StateEventType::RoomCreate, String::new())),
Some(_) | None
) {
return Err(Error::BadRequest(
@ -727,9 +725,7 @@ impl Service {
.get_shortstatekey(&StateEventType::RoomCreate, "")?
.expect("Room exists");
if state.get(&create_shortstatekey).map(|id| id.as_ref())
!= Some(&create_event.event_id)
{
if state.get(&create_shortstatekey) != Some(&create_event.event_id) {
return Err(Error::bad_database(
"Incoming event refers to wrong create event.",
));

View file

@ -78,7 +78,7 @@ impl Service {
})
})
.take(limit)
.filter_map(|r| r.ok()) // Filter out buggy events
.filter_map(Result::ok) // Filter out buggy events
.filter(|(_, pdu)| {
services()
.rooms
@ -125,7 +125,7 @@ impl Service {
})
})
.take(limit)
.filter_map(|r| r.ok()) // Filter out buggy events
.filter_map(Result::ok) // Filter out buggy events
.filter(|(_, pdu)| {
services()
.rooms

View file

@ -63,13 +63,13 @@ impl Service {
let mut results = Vec::new();
while let Some(current_room) = {
while stack.last().map_or(false, |s| s.is_empty()) {
while stack.last().map_or(false, Vec::is_empty) {
stack.pop();
}
if stack.is_empty() {
None
} else {
stack.last_mut().and_then(|s| s.pop())
stack.last_mut().and_then(Vec::pop)
}
} {
rooms_in_path.push(current_room.clone());

View file

@ -136,7 +136,7 @@ impl Service {
.rooms
.state_cache
.room_members(room_id)
.filter_map(|r| r.ok())
.filter_map(Result::ok)
.filter(|member| member.server_name() == origin);
let visibility = match history_visibility {

View file

@ -590,7 +590,7 @@ impl Service {
.rooms
.alias
.local_aliases_for_room(&pdu.room_id)
.filter_map(|r| r.ok())
.filter_map(Result::ok)
.any(|room_alias| aliases.is_match(room_alias.as_str()))
};
@ -838,7 +838,7 @@ impl Service {
.rooms
.state_cache
.room_members(room_id)
.filter_map(|m| m.ok())
.filter_map(Result::ok)
.filter(|m| m.server_name() == server_name)
.filter(|m| m != target)
.count();
@ -864,7 +864,7 @@ impl Service {
.rooms
.state_cache
.room_members(room_id)
.filter_map(|m| m.ok())
.filter_map(Result::ok)
.filter(|m| m.server_name() == server_name)
.filter(|m| m != target)
.count();
@ -965,7 +965,7 @@ impl Service {
.rooms
.state_cache
.room_servers(room_id)
.filter_map(|r| r.ok())
.filter_map(Result::ok)
.collect();
// In case we are kicking or banning a user, we need to inform their server of the change