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

@ -86,7 +86,7 @@ pub async fn report_event_route(
pdu.event_id,
pdu.room_id,
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("")
),
format!(
@ -100,7 +100,7 @@ pub async fn report_event_route(
pdu.event_id.to_owned(),
pdu.room_id.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(""))
),
));

View file

@ -215,7 +215,7 @@ pub async fn login_route(body: Ruma<login::v3::Request>) -> Result<login::v3::Re
.globals
.well_known_client()
.to_owned()
.unwrap_or("".to_owned()),
.unwrap_or_else(|| "".to_owned()),
));
info!("{} logged in", user_id);

View file

@ -554,12 +554,17 @@ async fn process_room_presence_updates(
// Update existing presence event with more info
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 =
new_content.last_active_ago.or(curr_content.last_active_ago);
curr_content.displayname =
new_content.displayname.or(curr_content.displayname.take());
curr_content.avatar_url = new_content.avatar_url.or(curr_content.avatar_url.take());
curr_content.displayname = new_content
.displayname
.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
.currently_active
.or(curr_content.currently_active);