Fix idiomatic let if

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-09 10:29:53 +00:00
parent eae41fc411
commit f52acd9cdf
3 changed files with 8 additions and 11 deletions

View file

@ -721,7 +721,6 @@ option_if_let_else = { level = "allow", priority = 1 } # TODO
redundant_pub_crate = { level = "allow", priority = 1 } # TODO redundant_pub_crate = { level = "allow", priority = 1 } # TODO
significant_drop_in_scrutinee = { level = "allow", priority = 1 } # TODO significant_drop_in_scrutinee = { level = "allow", priority = 1 } # TODO
significant_drop_tightening = { level = "allow", priority = 1 } # TODO significant_drop_tightening = { level = "allow", priority = 1 } # TODO
useless_let_if_seq = { level = "allow", priority = 1 } # TODO
################### ###################
pedantic = "warn" pedantic = "warn"

View file

@ -173,8 +173,7 @@ pub(crate) async fn register_route(body: Ruma<register::v3::Request>) -> Result<
// UIAA // UIAA
let mut uiaainfo; let mut uiaainfo;
let skip_auth; let skip_auth = if services().globals.config.registration_token.is_some() {
if services().globals.config.registration_token.is_some() {
// Registration token required // Registration token required
uiaainfo = UiaaInfo { uiaainfo = UiaaInfo {
flows: vec![AuthFlow { flows: vec![AuthFlow {
@ -185,7 +184,7 @@ pub(crate) async fn register_route(body: Ruma<register::v3::Request>) -> Result<
session: None, session: None,
auth_error: None, auth_error: None,
}; };
skip_auth = body.appservice_info.is_some(); body.appservice_info.is_some()
} else { } else {
// No registration token necessary, but clients must still go through the flow // No registration token necessary, but clients must still go through the flow
uiaainfo = UiaaInfo { uiaainfo = UiaaInfo {
@ -197,8 +196,8 @@ pub(crate) async fn register_route(body: Ruma<register::v3::Request>) -> Result<
session: None, session: None,
auth_error: None, auth_error: None,
}; };
skip_auth = body.appservice_info.is_some() || is_guest; body.appservice_info.is_some() || is_guest
} };
if !skip_auth { if !skip_auth {
if let Some(auth) = &body.auth { if let Some(auth) = &body.auth {

View file

@ -1042,8 +1042,7 @@ fn load_timeline(
sender_user: &UserId, room_id: &RoomId, roomsincecount: PduCount, limit: u64, sender_user: &UserId, room_id: &RoomId, roomsincecount: PduCount, limit: u64,
) -> Result<(Vec<(PduCount, PduEvent)>, bool), Error> { ) -> Result<(Vec<(PduCount, PduEvent)>, bool), Error> {
let timeline_pdus; let timeline_pdus;
let limited; let limited = if services()
if services()
.rooms .rooms
.timeline .timeline
.last_timeline_count(sender_user, room_id)? .last_timeline_count(sender_user, room_id)?
@ -1073,11 +1072,11 @@ fn load_timeline(
// They /sync response doesn't always return all messages, so we say the output // They /sync response doesn't always return all messages, so we say the output
// is limited unless there are events in non_timeline_pdus // is limited unless there are events in non_timeline_pdus
limited = non_timeline_pdus.next().is_some(); non_timeline_pdus.next().is_some()
} else { } else {
timeline_pdus = Vec::new(); timeline_pdus = Vec::new();
limited = false; false
} };
Ok((timeline_pdus, limited)) Ok((timeline_pdus, limited))
} }