enable too_many_lines lint

And just disable it everywhere it fires, I know.
This commit is contained in:
Charles Hall 2024-05-14 19:17:47 -07:00
parent 8ef278d358
commit baab928281
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
19 changed files with 27 additions and 1 deletions

View file

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

View file

@ -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<register::v3::Request>,
) -> Result<register::v3::Response> {

View file

@ -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<get_context::v3::Request>,
) -> Result<get_context::v3::Response> {

View file

@ -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<UInt>,

View file

@ -256,6 +256,7 @@ pub(crate) async fn get_key_changes_route(
})
}
#[allow(clippy::too_many_lines)]
pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
sender_user: Option<&UserId>,
device_keys_input: &BTreeMap<OwnedUserId, Vec<OwnedDeviceId>>,

View file

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

View file

@ -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<get_message_events::v3::Request>,
) -> Result<get_message_events::v3::Response> {

View file

@ -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<create_room::v3::Request>,
) -> Result<create_room::v3::Response> {
@ -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<upgrade_room::v3::Request>,
) -> Result<upgrade_room::v3::Response> {

View file

@ -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<search_events::v3::Request>,
) -> Result<search_events::v3::Response> {

View file

@ -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<login::v3::Request>) -> Result<login::v3::Response> {
// To allow deprecated login methods
#![allow(deprecated)]

View file

@ -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<sync_events::v4::Request>,
) -> Result<sync_events::v4::Response, RumaResponse<UiaaResponse>> {

View file

@ -40,6 +40,7 @@ where
{
type Rejection = Error;
#[allow(clippy::too_many_lines)]
async fn from_request(req: Request<B>, _state: &S) -> Result<Self, Self::Rejection> {
#[derive(Deserialize)]
struct QueryParams {

View file

@ -343,6 +343,7 @@ fn add_port_to_hostname(destination_str: &str) -> FedDest {
/// Returns: `actual_destination`, `Host` header
/// Implemented according to the specification at <https://matrix.org/docs/spec/server_server/r0.1.4#resolving-server-names>
/// 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<send_transaction_message::v1::Request>,
) -> Result<send_transaction_message::v1::Response> {
@ -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,

View file

@ -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)?;

View file

@ -279,6 +279,7 @@ async fn unrecognized_method<B: Send>(
Ok(inner)
}
#[allow(clippy::too_many_lines)]
fn routes(config: &Config) -> Router {
let router = Router::new()
.ruma_route(client_server::get_supported_versions_route)

View file

@ -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());

View file

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

View file

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

View file

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