fix some nightly clippy lints

Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
June Clementine Strawberry 2025-03-11 23:05:56 -04:00
parent 0877f29439
commit 1d1ccec532
6 changed files with 14 additions and 7 deletions

View file

@ -841,6 +841,9 @@ unused_crate_dependencies = "allow"
unsafe_code = "allow" unsafe_code = "allow"
variant_size_differences = "allow" variant_size_differences = "allow"
# we check nightly clippy lints
unknown_lints = "allow"
####################################### #######################################
# #
# Clippy lints # Clippy lints

View file

@ -2,9 +2,10 @@ array-size-threshold = 4096
cognitive-complexity-threshold = 94 # TODO reduce me ALARA cognitive-complexity-threshold = 94 # TODO reduce me ALARA
excessive-nesting-threshold = 11 # TODO reduce me to 4 or 5 excessive-nesting-threshold = 11 # TODO reduce me to 4 or 5
future-size-threshold = 7745 # TODO reduce me ALARA future-size-threshold = 7745 # TODO reduce me ALARA
stack-size-threshold = 196608 # reduce me ALARA stack-size-threshold = 196608 # TODO reduce me ALARA
too-many-lines-threshold = 780 # TODO reduce me to <= 100 too-many-lines-threshold = 780 # TODO reduce me to <= 100
type-complexity-threshold = 250 # reduce me to ~200 type-complexity-threshold = 250 # reduce me to ~200
large-error-threshold = 256 # TODO reduce me ALARA
disallowed-macros = [ disallowed-macros = [
{ path = "log::error", reason = "use conduwuit_core::error" }, { path = "log::error", reason = "use conduwuit_core::error" },

View file

@ -91,6 +91,7 @@ async fn process_command(services: Arc<Services>, input: &CommandInput) -> Proce
} }
} }
#[allow(clippy::result_large_err)]
fn handle_panic(error: &Error, command: &CommandInput) -> ProcessorResult { fn handle_panic(error: &Error, command: &CommandInput) -> ProcessorResult {
let link = let link =
"Please submit a [bug report](https://github.com/girlbossceo/conduwuit/issues/new). 🥺"; "Please submit a [bug report](https://github.com/girlbossceo/conduwuit/issues/new). 🥺";
@ -100,7 +101,7 @@ fn handle_panic(error: &Error, command: &CommandInput) -> ProcessorResult {
Err(reply(content, command.reply_id.as_deref())) Err(reply(content, command.reply_id.as_deref()))
} }
// Parse and process a message from the admin room /// Parse and process a message from the admin room
async fn process( async fn process(
context: &Command<'_>, context: &Command<'_>,
command: AdminCommand, command: AdminCommand,
@ -164,7 +165,8 @@ fn capture_create(context: &Command<'_>) -> (Arc<Capture>, Arc<Mutex<String>>) {
(capture, logs) (capture, logs)
} }
// Parse chat messages from the admin room into an AdminCommand object /// Parse chat messages from the admin room into an AdminCommand object
#[allow(clippy::result_large_err)]
fn parse<'a>( fn parse<'a>(
services: &Arc<Services>, services: &Arc<Services>,
input: &'a CommandInput, input: &'a CommandInput,
@ -232,7 +234,7 @@ fn complete_command(mut cmd: clap::Command, line: &str) -> String {
ret.join(" ") ret.join(" ")
} }
// Parse chat messages from the admin room into an AdminCommand object /// Parse chat messages from the admin room into an AdminCommand object
fn parse_line(command_line: &str) -> Vec<String> { fn parse_line(command_line: &str) -> Vec<String> {
let mut argv = command_line let mut argv = command_line
.split_whitespace() .split_whitespace()

View file

@ -109,7 +109,7 @@ pub(crate) async fn get_register_available_route(
if !info.is_user_match(&user_id) { if !info.is_user_match(&user_id) {
return Err!(Request(Exclusive("Username is not in an appservice namespace."))); return Err!(Request(Exclusive("Username is not in an appservice namespace.")));
} }
}; }
if services.appservice.is_exclusive_user_id(&user_id).await { if services.appservice.is_exclusive_user_id(&user_id).await {
return Err!(Request(Exclusive("Username is reserved by an appservice."))); return Err!(Request(Exclusive("Username is reserved by an appservice.")));
@ -159,7 +159,7 @@ pub(crate) async fn register_route(
| (None, _) => { | (None, _) => {
info!(%is_guest, "Rejecting registration attempt as registration is disabled"); info!(%is_guest, "Rejecting registration attempt as registration is disabled");
}, },
}; }
return Err!(Request(Forbidden("Registration has been disabled."))); return Err!(Request(Forbidden("Registration has been disabled.")));
} }

View file

@ -254,7 +254,7 @@ async fn allowed_to_send_state_event(
"Room server ACL event is invalid: {e}" "Room server ACL event is invalid: {e}"
)))); ))));
}, },
}; }
}, },
| StateEventType::RoomEncryption => | StateEventType::RoomEncryption =>
// Forbid m.room.encryption if encryption is disabled // Forbid m.room.encryption if encryption is disabled

View file

@ -60,6 +60,7 @@ pub fn camel_to_snake_string(s: &str) -> String {
} }
#[inline] #[inline]
#[allow(clippy::unbuffered_bytes)] // these are allocated string utilities, not file I/O utils
pub fn camel_to_snake_case<I, O>(output: &mut O, input: I) -> Result<()> pub fn camel_to_snake_case<I, O>(output: &mut O, input: I) -> Result<()>
where where
I: std::io::Read, I: std::io::Read,