diff --git a/Cargo.toml b/Cargo.toml index 74c8a0c7..ce074a79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -721,7 +721,6 @@ option_if_let_else = { level = "allow", priority = 1 } # TODO redundant_pub_crate = { level = "allow", priority = 1 } # TODO significant_drop_in_scrutinee = { level = "allow", priority = 1 } # TODO significant_drop_tightening = { level = "allow", priority = 1 } # TODO -useless_let_if_seq = { level = "allow", priority = 1 } # TODO ################### pedantic = "warn" diff --git a/src/api/client/account.rs b/src/api/client/account.rs index a5ff5d82..72830f9d 100644 --- a/src/api/client/account.rs +++ b/src/api/client/account.rs @@ -173,8 +173,7 @@ pub(crate) async fn register_route(body: Ruma) -> Result< // UIAA let mut uiaainfo; - let skip_auth; - if services().globals.config.registration_token.is_some() { + let skip_auth = if services().globals.config.registration_token.is_some() { // Registration token required uiaainfo = UiaaInfo { flows: vec![AuthFlow { @@ -185,7 +184,7 @@ pub(crate) async fn register_route(body: Ruma) -> Result< session: None, auth_error: None, }; - skip_auth = body.appservice_info.is_some(); + body.appservice_info.is_some() } else { // No registration token necessary, but clients must still go through the flow uiaainfo = UiaaInfo { @@ -197,8 +196,8 @@ pub(crate) async fn register_route(body: Ruma) -> Result< session: None, auth_error: None, }; - skip_auth = body.appservice_info.is_some() || is_guest; - } + body.appservice_info.is_some() || is_guest + }; if !skip_auth { if let Some(auth) = &body.auth { diff --git a/src/api/client/sync.rs b/src/api/client/sync.rs index 8a83cbe7..b441eb6c 100644 --- a/src/api/client/sync.rs +++ b/src/api/client/sync.rs @@ -1042,8 +1042,7 @@ fn load_timeline( sender_user: &UserId, room_id: &RoomId, roomsincecount: PduCount, limit: u64, ) -> Result<(Vec<(PduCount, PduEvent)>, bool), Error> { let timeline_pdus; - let limited; - if services() + let limited = if services() .rooms .timeline .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 // is limited unless there are events in non_timeline_pdus - limited = non_timeline_pdus.next().is_some(); + non_timeline_pdus.next().is_some() } else { timeline_pdus = Vec::new(); - limited = false; - } + false + }; Ok((timeline_pdus, limited)) }