Skip to content
Snippets Groups Projects
Commit f52acd9c authored by Jason Volk's avatar Jason Volk
Browse files

Fix idiomatic let if


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent eae41fc4
No related branches found
No related tags found
1 merge request!443Lints
...@@ -721,7 +721,6 @@ option_if_let_else = { level = "allow", priority = 1 } # TODO ...@@ -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"
......
...@@ -173,8 +173,7 @@ pub(crate) async fn register_route(body: Ruma<register::v3::Request>) -> Result< ...@@ -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< ...@@ -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< ...@@ -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 {
......
...@@ -1042,8 +1042,7 @@ fn load_timeline( ...@@ -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( ...@@ -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))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment