resolve clippy match_bool

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-22 21:55:05 -04:00 committed by June
parent 9d0b647911
commit 0bb5115bd1
4 changed files with 26 additions and 21 deletions

View file

@ -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"

View file

@ -16,7 +16,8 @@ use tracing::{error, info, warn};
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;

View file

@ -305,26 +305,27 @@ where
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 => {
)
} 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()??,

View file

@ -1025,12 +1025,13 @@ impl Service {
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,
});