diff --git a/Cargo.toml b/Cargo.toml index fd2da7b1..22e57bb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,6 +78,7 @@ string_to_string = "warn" struct_excessive_bools = "warn" suspicious_xor_used_as_pow = "warn" tests_outside_test_module = "warn" +too_many_lines = "warn" try_err = "warn" undocumented_unsafe_blocks = "warn" unnecessary_safety_comment = "warn" diff --git a/src/api/client_server/account.rs b/src/api/client_server/account.rs index 54b735b3..6d254a9c 100644 --- a/src/api/client_server/account.rs +++ b/src/api/client_server/account.rs @@ -74,6 +74,7 @@ pub(crate) async fn get_register_available_route( /// - If type is not guest and no username is given: Always fails after UIAA check /// - Creates a new account and populates it with default account data /// - If `inhibit_login` is false: Creates a device and returns `device_id` and `access_token` +#[allow(clippy::too_many_lines)] pub(crate) async fn register_route( body: Ruma, ) -> Result { diff --git a/src/api/client_server/context.rs b/src/api/client_server/context.rs index 14f5eb0d..a063a2ec 100644 --- a/src/api/client_server/context.rs +++ b/src/api/client_server/context.rs @@ -13,6 +13,7 @@ use tracing::error; /// /// - Only works if the user is joined (TODO: always allow, but only show events if the user was /// joined, depending on `history_visibility`) +#[allow(clippy::too_many_lines)] pub(crate) async fn get_context_route( body: Ruma, ) -> Result { diff --git a/src/api/client_server/directory.rs b/src/api/client_server/directory.rs index 4d926442..f4141fa9 100644 --- a/src/api/client_server/directory.rs +++ b/src/api/client_server/directory.rs @@ -123,6 +123,7 @@ pub(crate) async fn get_room_visibility_route( }) } +#[allow(clippy::too_many_lines)] pub(crate) async fn get_public_rooms_filtered_helper( server: Option<&ServerName>, limit: Option, diff --git a/src/api/client_server/keys.rs b/src/api/client_server/keys.rs index 4c104a6b..8a9191d1 100644 --- a/src/api/client_server/keys.rs +++ b/src/api/client_server/keys.rs @@ -256,6 +256,7 @@ pub(crate) async fn get_key_changes_route( }) } +#[allow(clippy::too_many_lines)] pub(crate) async fn get_keys_helper bool>( sender_user: Option<&UserId>, device_keys_input: &BTreeMap>, diff --git a/src/api/client_server/membership.rs b/src/api/client_server/membership.rs index 21332ed9..84b92f4f 100644 --- a/src/api/client_server/membership.rs +++ b/src/api/client_server/membership.rs @@ -518,6 +518,7 @@ pub(crate) async fn joined_members_route( Ok(joined_members::v3::Response { joined }) } +#[allow(clippy::too_many_lines)] async fn join_room_by_id_helper( sender_user: Option<&UserId>, room_id: &RoomId, @@ -1200,6 +1201,7 @@ async fn validate_and_add_event_id( Ok((event_id, value)) } +#[allow(clippy::too_many_lines)] pub(crate) async fn invite_helper( sender_user: &UserId, user_id: &UserId, diff --git a/src/api/client_server/message.rs b/src/api/client_server/message.rs index db8c8bf8..76b367c8 100644 --- a/src/api/client_server/message.rs +++ b/src/api/client_server/message.rs @@ -112,6 +112,7 @@ pub(crate) async fn send_message_event_route( /// /// - Only works if the user is joined (TODO: always allow, but only show events where the user was /// joined, depending on `history_visibility`) +#[allow(clippy::too_many_lines)] pub(crate) async fn get_message_events_route( body: Ruma, ) -> Result { diff --git a/src/api/client_server/room.rs b/src/api/client_server/room.rs index 8167ed25..1b266e25 100644 --- a/src/api/client_server/room.rs +++ b/src/api/client_server/room.rs @@ -45,6 +45,7 @@ use tracing::{info, warn}; /// - Send events listed in initial state /// - Send events implied by `name` and `topic` /// - Send invite events +#[allow(clippy::too_many_lines)] pub(crate) async fn create_room_route( body: Ruma, ) -> Result { @@ -580,6 +581,7 @@ pub(crate) async fn get_room_aliases_route( /// - Transfers some state events /// - Moves local aliases /// - Modifies old room power levels to prevent users from speaking +#[allow(clippy::too_many_lines)] pub(crate) async fn upgrade_room_route( body: Ruma, ) -> Result { diff --git a/src/api/client_server/search.rs b/src/api/client_server/search.rs index 3743b877..9d69d3b8 100644 --- a/src/api/client_server/search.rs +++ b/src/api/client_server/search.rs @@ -17,6 +17,7 @@ use std::collections::BTreeMap; /// Searches rooms for messages. /// /// - Only works if the user is currently joined to the room (TODO: Respect history visibility) +#[allow(clippy::too_many_lines)] pub(crate) async fn search_events_route( body: Ruma, ) -> Result { diff --git a/src/api/client_server/session.rs b/src/api/client_server/session.rs index 9d1cc552..7a58a992 100644 --- a/src/api/client_server/session.rs +++ b/src/api/client_server/session.rs @@ -47,6 +47,7 @@ pub(crate) async fn get_login_types_route( /// /// Note: You can use [`GET /_matrix/client/r0/login`](fn.get_supported_versions_route.html) to see /// supported login types. +#[allow(clippy::too_many_lines)] pub(crate) async fn login_route(body: Ruma) -> Result { // To allow deprecated login methods #![allow(deprecated)] diff --git a/src/api/client_server/sync.rs b/src/api/client_server/sync.rs index b5799bf5..7655c66d 100644 --- a/src/api/client_server/sync.rs +++ b/src/api/client_server/sync.rs @@ -168,6 +168,7 @@ async fn sync_helper_wrapper( .expect("receiver should not be dropped"); } +#[allow(clippy::too_many_lines)] async fn sync_helper( sender_user: OwnedUserId, sender_device: OwnedDeviceId, @@ -546,7 +547,7 @@ async fn sync_helper( } } -#[allow(clippy::too_many_arguments)] +#[allow(clippy::too_many_arguments, clippy::too_many_lines)] async fn load_joined_room( sender_user: &UserId, sender_device: &DeviceId, @@ -1154,6 +1155,7 @@ fn share_encrypted_room( .any(|encrypted| encrypted)) } +#[allow(clippy::too_many_lines)] pub(crate) async fn sync_events_v4_route( body: Ruma, ) -> Result> { diff --git a/src/api/ruma_wrapper/axum.rs b/src/api/ruma_wrapper/axum.rs index 84209ca7..22931cf2 100644 --- a/src/api/ruma_wrapper/axum.rs +++ b/src/api/ruma_wrapper/axum.rs @@ -40,6 +40,7 @@ where { type Rejection = Error; + #[allow(clippy::too_many_lines)] async fn from_request(req: Request, _state: &S) -> Result { #[derive(Deserialize)] struct QueryParams { diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 41b0db57..daba63ff 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -343,6 +343,7 @@ fn add_port_to_hostname(destination_str: &str) -> FedDest { /// Returns: `actual_destination`, `Host` header /// Implemented according to the specification at /// Numbers in comments below refer to bullet points in linked section of specification +#[allow(clippy::too_many_lines)] async fn find_actual_destination(destination: &'_ ServerName) -> (FedDest, FedDest) { debug!("Finding actual destination for {destination}"); let destination_str = destination.as_str().to_owned(); @@ -653,6 +654,7 @@ pub(crate) fn parse_incoming_pdu( /// # `PUT /_matrix/federation/v1/send/{txnId}` /// /// Push EDUs and PDUs to this server. +#[allow(clippy::too_many_lines)] pub(crate) async fn send_transaction_message_route( body: Ruma, ) -> Result { @@ -1432,6 +1434,7 @@ pub(crate) async fn create_join_event_template_route( }) } +#[allow(clippy::too_many_lines)] async fn create_join_event( sender_servername: &ServerName, room_id: &RoomId, diff --git a/src/database.rs b/src/database.rs index d3fda641..3e105120 100644 --- a/src/database.rs +++ b/src/database.rs @@ -214,6 +214,7 @@ impl KeyValueDatabase { not(any(feature = "rocksdb", feature = "sqlite")), allow(unreachable_code) )] + #[allow(clippy::too_many_lines)] pub(crate) async fn load_or_create(config: Config) -> Result<()> { Self::check_db_setup(&config)?; diff --git a/src/main.rs b/src/main.rs index ab06163f..def5a85a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -279,6 +279,7 @@ async fn unrecognized_method( Ok(inner) } +#[allow(clippy::too_many_lines)] fn routes(config: &Config) -> Router { let router = Router::new() .ruma_route(client_server::get_supported_versions_route) diff --git a/src/service/admin.rs b/src/service/admin.rs index 6545c062..1a7cd8aa 100644 --- a/src/service/admin.rs +++ b/src/service/admin.rs @@ -327,6 +327,7 @@ impl Service { AdminCommand::try_parse_from(argv).map_err(|error| error.to_string()) } + #[allow(clippy::too_many_lines)] async fn process_admin_command( &self, command: AdminCommand, @@ -933,6 +934,7 @@ impl Service { /// /// Users in this room are considered admins by grapevine, and the room can be /// used to issue admin commands by talking to the server user inside it. + #[allow(clippy::too_many_lines)] pub(crate) async fn create_admin_room(&self) -> Result<()> { let room_id = RoomId::new(services().globals.server_name()); diff --git a/src/service/rooms/spaces.rs b/src/service/rooms/spaces.rs index af019e3d..0ffbbf9a 100644 --- a/src/service/rooms/spaces.rs +++ b/src/service/rooms/spaces.rs @@ -47,6 +47,7 @@ pub(crate) struct Service { } impl Service { + #[allow(clippy::too_many_lines)] pub(crate) async fn get_hierarchy( &self, sender_user: &UserId, @@ -306,6 +307,7 @@ impl Service { }) } + #[allow(clippy::too_many_lines)] fn get_room_chunk( &self, sender_user: &UserId, diff --git a/src/service/rooms/timeline.rs b/src/service/rooms/timeline.rs index 33cd1889..4dce9420 100644 --- a/src/service/rooms/timeline.rs +++ b/src/service/rooms/timeline.rs @@ -607,6 +607,7 @@ impl Service { Ok(pdu_id) } + #[allow(clippy::too_many_lines)] pub(crate) fn create_hash_and_sign_event( &self, pdu_builder: PduBuilder, diff --git a/src/service/users.rs b/src/service/users.rs index b63e90bb..2e52f478 100644 --- a/src/service/users.rs +++ b/src/service/users.rs @@ -57,6 +57,7 @@ impl Service { .remove(&(user_id, device_id, conn_id)); } + #[allow(clippy::too_many_lines)] pub(crate) fn update_sync_request_with_cache( &self, user_id: OwnedUserId,