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"
variant_size_differences = "allow"
# we check nightly clippy lints
unknown_lints = "allow"
#######################################
#
# Clippy lints

View file

@ -2,9 +2,10 @@ array-size-threshold = 4096
cognitive-complexity-threshold = 94 # TODO reduce me ALARA
excessive-nesting-threshold = 11 # TODO reduce me to 4 or 5
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
type-complexity-threshold = 250 # reduce me to ~200
large-error-threshold = 256 # TODO reduce me ALARA
disallowed-macros = [
{ 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 {
let link =
"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()))
}
// Parse and process a message from the admin room
/// Parse and process a message from the admin room
async fn process(
context: &Command<'_>,
command: AdminCommand,
@ -164,7 +165,8 @@ fn capture_create(context: &Command<'_>) -> (Arc<Capture>, Arc<Mutex<String>>) {
(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>(
services: &Arc<Services>,
input: &'a CommandInput,
@ -232,7 +234,7 @@ fn complete_command(mut cmd: clap::Command, line: &str) -> String {
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> {
let mut argv = command_line
.split_whitespace()

View file

@ -109,7 +109,7 @@ pub(crate) async fn get_register_available_route(
if !info.is_user_match(&user_id) {
return Err!(Request(Exclusive("Username is not in an appservice namespace.")));
}
};
}
if services.appservice.is_exclusive_user_id(&user_id).await {
return Err!(Request(Exclusive("Username is reserved by an appservice.")));
@ -159,7 +159,7 @@ pub(crate) async fn register_route(
| (None, _) => {
info!(%is_guest, "Rejecting registration attempt as registration is 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}"
))));
},
};
}
},
| StateEventType::RoomEncryption =>
// Forbid m.room.encryption if encryption is disabled

View file

@ -60,6 +60,7 @@ pub fn camel_to_snake_string(s: &str) -> String {
}
#[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<()>
where
I: std::io::Read,