resolve clippy match_bool
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
9d0b647911
commit
0bb5115bd1
|
@ -496,6 +496,7 @@ cast_possible_wrap = "warn"
|
||||||
redundant_closure_for_method_calls = "warn"
|
redundant_closure_for_method_calls = "warn"
|
||||||
large_futures = "warn"
|
large_futures = "warn"
|
||||||
semicolon_if_nothing_returned = "warn"
|
semicolon_if_nothing_returned = "warn"
|
||||||
|
match_bool = "warn"
|
||||||
|
|
||||||
# not in rust 1.75.0 (breaks CI)
|
# not in rust 1.75.0 (breaks CI)
|
||||||
# infinite_loop = "warn"
|
# infinite_loop = "warn"
|
||||||
|
|
|
@ -16,7 +16,8 @@ use tracing::{error, info, warn};
|
||||||
|
|
||||||
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
||||||
use crate::{
|
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;
|
const RANDOM_USER_ID_LENGTH: usize = 10;
|
||||||
|
|
|
@ -305,26 +305,27 @@ where
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
// we do not need to log that servers in a room are dead, this is normal in
|
// we do not need to log that servers in a room are dead, this is normal in
|
||||||
// public rooms and just spams the logs.
|
// public rooms and just spams the logs.
|
||||||
match e.is_timeout() {
|
if e.is_timeout() {
|
||||||
true => debug!(
|
debug!(
|
||||||
"Timed out sending request to {} at {}: {}",
|
"Timed out sending request to {} at {}: {}",
|
||||||
destination, actual_destination_str, e
|
destination, actual_destination_str, e
|
||||||
),
|
)
|
||||||
false => match e.is_connect() {
|
} else {
|
||||||
true => debug!("Failed to connect to {} at {}: {}", destination, actual_destination_str, e),
|
if e.is_connect() {
|
||||||
false => match e.is_redirect() {
|
debug!("Failed to connect to {} at {}: {}", destination, actual_destination_str, e)
|
||||||
true => debug!(
|
} else {
|
||||||
|
if e.is_redirect() {
|
||||||
|
debug!(
|
||||||
"Redirect loop sending request to {} at {}: {}\nFinal URL: {:?}",
|
"Redirect loop sending request to {} at {}: {}\nFinal URL: {:?}",
|
||||||
destination,
|
destination,
|
||||||
actual_destination_str,
|
actual_destination_str,
|
||||||
e,
|
e,
|
||||||
e.url()
|
e.url()
|
||||||
),
|
)
|
||||||
false => {
|
} else {
|
||||||
info!("Could not send request to {} at {}: {}", destination, actual_destination_str, e);
|
info!("Could not send request to {} at {}: {}", destination, actual_destination_str, e);
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
Err(e.into())
|
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(Result::ok)
|
||||||
.filter_map(|metadata| {
|
.filter_map(|metadata| {
|
||||||
let device_id_string = metadata.device_id.as_str().to_owned();
|
let device_id_string = metadata.device_id.as_str().to_owned();
|
||||||
let device_display_name = match services().globals.allow_device_name_federation() {
|
let device_display_name = if services().globals.allow_device_name_federation() {
|
||||||
true => metadata.display_name,
|
metadata.display_name
|
||||||
false => Some(device_id_string),
|
} else {
|
||||||
|
Some(device_id_string)
|
||||||
};
|
};
|
||||||
Some(UserDevice {
|
Some(UserDevice {
|
||||||
keys: services().users.get_device_keys(&body.user_id, &metadata.device_id).ok()??,
|
keys: services().users.get_device_keys(&body.user_id, &metadata.device_id).ok()??,
|
||||||
|
|
|
@ -1025,12 +1025,13 @@ impl Service {
|
||||||
|
|
||||||
if !force {
|
if !force {
|
||||||
user_ids.retain(|&user_id| match services().users.is_admin(user_id) {
|
user_ids.retain(|&user_id| match services().users.is_admin(user_id) {
|
||||||
Ok(is_admin) => match is_admin {
|
Ok(is_admin) => {
|
||||||
true => {
|
if is_admin {
|
||||||
admins.push(user_id.localpart());
|
admins.push(user_id.localpart());
|
||||||
false
|
false
|
||||||
},
|
} else {
|
||||||
false => true,
|
true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Err(_) => false,
|
Err(_) => false,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue