diff --git a/Cargo.toml b/Cargo.toml index 41ff2b402e869a0dfd9efd2bfc25be19e122a9c6..f250a68fea3eb31fe411a6cb83bd003f900e3564 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -496,6 +496,7 @@ cast_possible_wrap = "warn" redundant_closure_for_method_calls = "warn" large_futures = "warn" semicolon_if_nothing_returned = "warn" +match_bool = "warn" # not in rust 1.75.0 (breaks CI) # infinite_loop = "warn" diff --git a/src/api/client_server/account.rs b/src/api/client_server/account.rs index 90d9a2b45ead97f16188765cdcf7a38792826c23..2fbf743eda40c3100e84ef0ae5251ec88f838e69 100644 --- a/src/api/client_server/account.rs +++ b/src/api/client_server/account.rs @@ -16,7 +16,8 @@ use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH}; use crate::{ - api::client_server::{self, join_room_by_id_helper}, service, services, utils, Error, Result, Ruma + api::client_server::{self, join_room_by_id_helper}, + service, services, utils, Error, Result, Ruma, }; const RANDOM_USER_ID_LENGTH: usize = 10; diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 5002ea649a5c7d0f52c581647359c68eb1744812..d7ff846e1e099d80a97f9247a324ac630803bdc1 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -305,26 +305,27 @@ pub(crate) async fn send_request<T>(destination: &ServerName, request: T) -> Res Err(e) => { // we do not need to log that servers in a room are dead, this is normal in // public rooms and just spams the logs. - match e.is_timeout() { - true => debug!( + if e.is_timeout() { + debug!( "Timed out sending request to {} at {}: {}", destination, actual_destination_str, e - ), - false => match e.is_connect() { - true => debug!("Failed to connect to {} at {}: {}", destination, actual_destination_str, e), - false => match e.is_redirect() { - true => debug!( + ) + } else { + if e.is_connect() { + debug!("Failed to connect to {} at {}: {}", destination, actual_destination_str, e) + } else { + if e.is_redirect() { + debug!( "Redirect loop sending request to {} at {}: {}\nFinal URL: {:?}", destination, actual_destination_str, e, e.url() - ), - false => { - info!("Could not send request to {} at {}: {}", destination, actual_destination_str, e); - }, - }, - }, + ) + } else { + info!("Could not send request to {} at {}: {}", destination, actual_destination_str, e); + } + } } Err(e.into()) }, @@ -1617,9 +1618,10 @@ pub async fn get_devices_route(body: Ruma<get_devices::v1::Request>) -> Result<g .filter_map(Result::ok) .filter_map(|metadata| { let device_id_string = metadata.device_id.as_str().to_owned(); - let device_display_name = match services().globals.allow_device_name_federation() { - true => metadata.display_name, - false => Some(device_id_string), + let device_display_name = if services().globals.allow_device_name_federation() { + metadata.display_name + } else { + Some(device_id_string) }; Some(UserDevice { keys: services().users.get_device_keys(&body.user_id, &metadata.device_id).ok()??, diff --git a/src/service/admin/mod.rs b/src/service/admin/mod.rs index 3a031ad41d32749edaedfcd3cb9c0759cffe398c..291333df14147b252235a5be8852f0c015e3c489 100644 --- a/src/service/admin/mod.rs +++ b/src/service/admin/mod.rs @@ -1025,12 +1025,13 @@ async fn process_admin_command(&self, command: AdminCommand, body: Vec<&str>) -> if !force { user_ids.retain(|&user_id| match services().users.is_admin(user_id) { - Ok(is_admin) => match is_admin { - true => { + Ok(is_admin) => { + if is_admin { admins.push(user_id.localpart()); false - }, - false => true, + } else { + true + } }, Err(_) => false, });