resolve or_fun_call clippy lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
93cc98a04c
commit
cde6fdd741
7 changed files with 21 additions and 13 deletions
|
@ -257,5 +257,5 @@ unseparated_literal_suffix = "warn"
|
||||||
# unwrap_used = "warn"
|
# unwrap_used = "warn"
|
||||||
# expect_used = "warn"
|
# expect_used = "warn"
|
||||||
wildcard_dependencies = "warn"
|
wildcard_dependencies = "warn"
|
||||||
# or_fun_call = "warn"
|
or_fun_call = "warn"
|
||||||
unnecessary_lazy_evaluations = "warn"
|
unnecessary_lazy_evaluations = "warn"
|
||||||
|
|
|
@ -86,7 +86,7 @@ pub async fn report_event_route(
|
||||||
pdu.event_id,
|
pdu.event_id,
|
||||||
pdu.room_id,
|
pdu.room_id,
|
||||||
pdu.sender.to_owned(),
|
pdu.sender.to_owned(),
|
||||||
body.score.unwrap_or(ruma::Int::from(0)),
|
body.score.unwrap_or_else(|| ruma::Int::from(0)),
|
||||||
body.reason.as_deref().unwrap_or("")
|
body.reason.as_deref().unwrap_or("")
|
||||||
),
|
),
|
||||||
format!(
|
format!(
|
||||||
|
@ -100,7 +100,7 @@ pub async fn report_event_route(
|
||||||
pdu.event_id.to_owned(),
|
pdu.event_id.to_owned(),
|
||||||
pdu.room_id.to_owned(),
|
pdu.room_id.to_owned(),
|
||||||
pdu.sender.to_owned(),
|
pdu.sender.to_owned(),
|
||||||
body.score.unwrap_or(ruma::Int::from(0)),
|
body.score.unwrap_or_else(|| ruma::Int::from(0)),
|
||||||
HtmlEscape(body.reason.as_deref().unwrap_or(""))
|
HtmlEscape(body.reason.as_deref().unwrap_or(""))
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
|
@ -215,7 +215,7 @@ pub async fn login_route(body: Ruma<login::v3::Request>) -> Result<login::v3::Re
|
||||||
.globals
|
.globals
|
||||||
.well_known_client()
|
.well_known_client()
|
||||||
.to_owned()
|
.to_owned()
|
||||||
.unwrap_or("".to_owned()),
|
.unwrap_or_else(|| "".to_owned()),
|
||||||
));
|
));
|
||||||
|
|
||||||
info!("{} logged in", user_id);
|
info!("{} logged in", user_id);
|
||||||
|
|
|
@ -554,12 +554,17 @@ async fn process_room_presence_updates(
|
||||||
|
|
||||||
// Update existing presence event with more info
|
// Update existing presence event with more info
|
||||||
curr_content.presence = new_content.presence;
|
curr_content.presence = new_content.presence;
|
||||||
curr_content.status_msg = new_content.status_msg.or(curr_content.status_msg.take());
|
curr_content.status_msg = new_content
|
||||||
|
.status_msg
|
||||||
|
.or_else(|| curr_content.status_msg.take());
|
||||||
curr_content.last_active_ago =
|
curr_content.last_active_ago =
|
||||||
new_content.last_active_ago.or(curr_content.last_active_ago);
|
new_content.last_active_ago.or(curr_content.last_active_ago);
|
||||||
curr_content.displayname =
|
curr_content.displayname = new_content
|
||||||
new_content.displayname.or(curr_content.displayname.take());
|
.displayname
|
||||||
curr_content.avatar_url = new_content.avatar_url.or(curr_content.avatar_url.take());
|
.or_else(|| curr_content.displayname.take());
|
||||||
|
curr_content.avatar_url = new_content
|
||||||
|
.avatar_url
|
||||||
|
.or_else(|| curr_content.avatar_url.take());
|
||||||
curr_content.currently_active = new_content
|
curr_content.currently_active = new_content
|
||||||
.currently_active
|
.currently_active
|
||||||
.or(curr_content.currently_active);
|
.or(curr_content.currently_active);
|
||||||
|
|
|
@ -1961,7 +1961,7 @@ impl Service {
|
||||||
.get_name(&id)
|
.get_name(&id)
|
||||||
.ok()
|
.ok()
|
||||||
.flatten()
|
.flatten()
|
||||||
.unwrap_or(id.to_string()),
|
.unwrap_or_else(|| id.to_string()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,10 @@ impl Service {
|
||||||
user_id,
|
user_id,
|
||||||
presence: presence_event.content.presence,
|
presence: presence_event.content.presence,
|
||||||
currently_active: presence_event.content.currently_active.unwrap_or(false),
|
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,
|
status_msg: presence_event.content.status_msg,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ impl Service {
|
||||||
list.include_old_rooms = list
|
list.include_old_rooms = list
|
||||||
.include_old_rooms
|
.include_old_rooms
|
||||||
.clone()
|
.clone()
|
||||||
.or(cached_list.include_old_rooms.clone());
|
.or_else(|| cached_list.include_old_rooms.clone());
|
||||||
match (&mut list.filters, cached_list.filters.clone()) {
|
match (&mut list.filters, cached_list.filters.clone()) {
|
||||||
(Some(list_filters), Some(cached_filters)) => {
|
(Some(list_filters), Some(cached_filters)) => {
|
||||||
list_filters.is_dm = list_filters.is_dm.or(cached_filters.is_dm);
|
list_filters.is_dm = list_filters.is_dm.or(cached_filters.is_dm);
|
||||||
|
@ -168,13 +168,13 @@ impl Service {
|
||||||
.account_data
|
.account_data
|
||||||
.lists
|
.lists
|
||||||
.clone()
|
.clone()
|
||||||
.or(cached.extensions.account_data.lists.clone());
|
.or_else(|| cached.extensions.account_data.lists.clone());
|
||||||
request.extensions.account_data.rooms = request
|
request.extensions.account_data.rooms = request
|
||||||
.extensions
|
.extensions
|
||||||
.account_data
|
.account_data
|
||||||
.rooms
|
.rooms
|
||||||
.clone()
|
.clone()
|
||||||
.or(cached.extensions.account_data.rooms.clone());
|
.or_else(|| cached.extensions.account_data.rooms.clone());
|
||||||
|
|
||||||
cached.extensions = request.extensions.clone();
|
cached.extensions = request.extensions.clone();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue