resolve or_fun_call clippy lint

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-02 17:09:10 -05:00 committed by June
parent 93cc98a04c
commit cde6fdd741
7 changed files with 21 additions and 13 deletions

View file

@ -1961,7 +1961,7 @@ impl Service {
.get_name(&id)
.ok()
.flatten()
.unwrap_or(id.to_string()),
.unwrap_or_else(|| id.to_string()),
)
}

View file

@ -310,7 +310,10 @@ impl Service {
user_id,
presence: presence_event.content.presence,
currently_active: presence_event.content.currently_active.unwrap_or(false),
last_active_ago: presence_event.content.last_active_ago.unwrap_or(uint!(0)),
last_active_ago: presence_event
.content
.last_active_ago
.unwrap_or_else(|| uint!(0)),
status_msg: presence_event.content.status_msg,
});
}

View file

@ -100,7 +100,7 @@ impl Service {
list.include_old_rooms = list
.include_old_rooms
.clone()
.or(cached_list.include_old_rooms.clone());
.or_else(|| cached_list.include_old_rooms.clone());
match (&mut list.filters, cached_list.filters.clone()) {
(Some(list_filters), Some(cached_filters)) => {
list_filters.is_dm = list_filters.is_dm.or(cached_filters.is_dm);
@ -168,13 +168,13 @@ impl Service {
.account_data
.lists
.clone()
.or(cached.extensions.account_data.lists.clone());
.or_else(|| cached.extensions.account_data.lists.clone());
request.extensions.account_data.rooms = request
.extensions
.account_data
.rooms
.clone()
.or(cached.extensions.account_data.rooms.clone());
.or_else(|| cached.extensions.account_data.rooms.clone());
cached.extensions = request.extensions.clone();