Skip to content

Commit

Permalink
Allow clippy::too_many_arguments to lint without warnings (#17249)
Browse files Browse the repository at this point in the history
# Objective
Many instances of `clippy::too_many_arguments` linting happen to be on
systems - functions which we don't call manually, and thus there's not
much reason to worry about the argument count.

## Solution
Allow `clippy::too_many_arguments` globally, and remove all lint
attributes related to it.
  • Loading branch information
LikeLakers2 authored Jan 9, 2025
1 parent 7b56a1a commit 3742e62
Show file tree
Hide file tree
Showing 65 changed files with 4 additions and 178 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type_complexity = "allow"
undocumented_unsafe_blocks = "warn"
unwrap_or_default = "warn"
needless_lifetimes = "allow"
too_many_arguments = "allow"

ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
Expand Down Expand Up @@ -82,6 +83,7 @@ type_complexity = "allow"
undocumented_unsafe_blocks = "warn"
unwrap_or_default = "warn"
needless_lifetimes = "allow"
too_many_arguments = "allow"

ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
Expand Down
1 change: 1 addition & 0 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type_complexity = "allow"
undocumented_unsafe_blocks = "warn"
unwrap_or_default = "warn"
needless_lifetimes = "allow"
too_many_arguments = "allow"

ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
Expand Down
1 change: 0 additions & 1 deletion benches/benches/bevy_reflect/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ fn simple<T: std::ops::Add<Output = T>>(a: T, b: T) -> T {
a + b
}

#[expect(clippy::too_many_arguments)]
fn complex<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
_: T0,
_: T1,
Expand Down
4 changes: 0 additions & 4 deletions crates/bevy_asset/src/server/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ impl AssetInfos {
.unwrap()
}

#[expect(
clippy::too_many_arguments,
reason = "Arguments needed so that both `create_loading_handle_untyped()` and `get_or_create_path_handle_internal()` may share code."
)]
fn create_handle_internal(
infos: &mut HashMap<UntypedAssetId, AssetInfo>,
handle_providers: &TypeIdMap<AssetHandleProvider>,
Expand Down
4 changes: 0 additions & 4 deletions crates/bevy_core_pipeline/src/core_3d/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ pub fn extract_core_3d_camera_phases(

// Extract the render phases for the prepass

#[allow(clippy::too_many_arguments)]
pub fn extract_camera_prepass_phase(
mut commands: Commands,
mut opaque_3d_prepass_phases: ResMut<ViewBinnedRenderPhases<Opaque3dPrepass>>,
Expand Down Expand Up @@ -689,7 +688,6 @@ pub fn extract_camera_prepass_phase(
alpha_mask_3d_deferred_phases.retain(|entity, _| live_entities.contains(entity));
}

#[allow(clippy::too_many_arguments)]
pub fn prepare_core_3d_depth_textures(
mut commands: Commands,
mut texture_cache: ResMut<TextureCache>,
Expand Down Expand Up @@ -780,7 +778,6 @@ pub struct ViewTransmissionTexture {
pub sampler: Sampler,
}

#[allow(clippy::too_many_arguments)]
pub fn prepare_core_3d_transmission_textures(
mut commands: Commands,
mut texture_cache: ResMut<TextureCache>,
Expand Down Expand Up @@ -880,7 +877,6 @@ pub fn check_msaa(mut deferred_views: Query<&mut Msaa, (With<Camera>, With<Defer
}

// Prepares the textures used by the prepass
#[allow(clippy::too_many_arguments)]
pub fn prepare_prepass_textures(
mut commands: Commands,
mut texture_cache: ResMut<TextureCache>,
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_core_pipeline/src/oit/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ pub struct OitResolvePipelineKey {
layer_count: i32,
}

#[allow(clippy::too_many_arguments)]
pub fn queue_oit_resolve_pipeline(
mut commands: Commands,
pipeline_cache: Res<PipelineCache>,
Expand Down
3 changes: 0 additions & 3 deletions crates/bevy_core_pipeline/src/smaa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,6 @@ impl ViewNode for SmaaNode {
/// writes to the two-channel RG edges texture. Additionally, it ensures that
/// all pixels it didn't touch are stenciled out so that phase 2 won't have to
/// examine them.
#[allow(clippy::too_many_arguments)]
fn perform_edge_detection(
render_context: &mut RenderContext,
smaa_pipelines: &SmaaPipelines,
Expand Down Expand Up @@ -965,7 +964,6 @@ fn perform_edge_detection(
/// This runs as part of the [`SmaaNode`]. It reads the edges texture and writes
/// to the blend weight texture, using the stencil buffer to avoid processing
/// pixels it doesn't need to examine.
#[allow(clippy::too_many_arguments)]
fn perform_blending_weight_calculation(
render_context: &mut RenderContext,
smaa_pipelines: &SmaaPipelines,
Expand Down Expand Up @@ -1024,7 +1022,6 @@ fn perform_blending_weight_calculation(
///
/// This runs as part of the [`SmaaNode`]. It reads from the blend weight
/// texture. It's the only phase that writes to the postprocessing destination.
#[allow(clippy::too_many_arguments)]
fn perform_neighborhood_blending(
render_context: &mut RenderContext,
smaa_pipelines: &SmaaPipelines,
Expand Down
8 changes: 0 additions & 8 deletions crates/bevy_ecs/macros/src/world_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ use proc_macro2::Ident;
use quote::quote;
use syn::{Attribute, Fields, ImplGenerics, TypeGenerics, Visibility, WhereClause};

#[expect(
clippy::too_many_arguments,
reason = "Required to generate the entire item structure."
)]
pub(crate) fn item_struct(
path: &syn::Path,
fields: &Fields,
Expand Down Expand Up @@ -55,10 +51,6 @@ pub(crate) fn item_struct(
}
}

#[expect(
clippy::too_many_arguments,
reason = "Required to generate the entire world query implementation."
)]
pub(crate) fn world_query_impl(
path: &syn::Path,
struct_name: &Ident,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_ecs/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ impl BundleInfo {
/// `table` must be the "new" table for `entity`. `table_row` must have space allocated for the
/// `entity`, `bundle` must match this [`BundleInfo`]'s type
#[inline]
#[allow(clippy::too_many_arguments)]
unsafe fn write_components<'a, T: DynamicBundle, S: BundleComponentStatus>(
&self,
table: &mut Table,
Expand Down Expand Up @@ -594,7 +593,6 @@ impl BundleInfo {
/// This method _should not_ be called outside of [`BundleInfo::write_components`].
/// For more information, read the [`BundleInfo::write_components`] safety docs.
/// This function inherits the safety requirements defined there.
#[allow(clippy::too_many_arguments)]
pub(crate) unsafe fn initialize_required_component(
table: &mut Table,
sparse_sets: &mut SparseSets,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_ecs/src/system/exclusive_function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ macro_rules! impl_exclusive_system_function {
// Yes, this is strange, but `rustc` fails to compile this impl
// without using this function. It fails to recognize that `func`
// is a function, potentially because of the multiple impls of `FnMut`
#[allow(clippy::too_many_arguments)]
fn call_inner<Out, $($param,)*>(
mut f: impl FnMut(&mut World, $($param,)*) -> Out,
world: &mut World,
Expand Down Expand Up @@ -267,7 +266,6 @@ macro_rules! impl_exclusive_system_function {
// Yes, this is strange, but `rustc` fails to compile this impl
// without using this function. It fails to recognize that `func`
// is a function, potentially because of the multiple impls of `FnMut`
#[allow(clippy::too_many_arguments)]
fn call_inner<In: SystemInput, Out, $($param,)*>(
mut f: impl FnMut(In::Param<'_>, &mut World, $($param,)*) -> Out,
input: In::Inner<'_>,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_ecs/src/system/function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,6 @@ macro_rules! impl_system_function {
// Yes, this is strange, but `rustc` fails to compile this impl
// without using this function. It fails to recognize that `func`
// is a function, potentially because of the multiple impls of `FnMut`
#[allow(clippy::too_many_arguments)]
fn call_inner<Out, $($param,)*>(
mut f: impl FnMut($($param,)*)->Out,
$($param: $param,)*
Expand All @@ -1056,7 +1055,6 @@ macro_rules! impl_system_function {
type Param = ($($param,)*);
#[inline]
fn run(&mut self, input: In::Inner<'_>, param_value: SystemParamItem< ($($param,)*)>) -> Out {
#[allow(clippy::too_many_arguments)]
fn call_inner<In: SystemInput, Out, $($param,)*>(
mut f: impl FnMut(In::Param<'_>, $($param,)*)->Out,
input: In::Inner<'_>,
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_ecs/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,6 @@ mod tests {
}

#[test]
#[allow(clippy::too_many_arguments)]
fn can_have_16_parameters() {
fn sys_x(
_: Res<A>,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_ecs/src/world/entity_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,6 @@ impl<'w> EntityWorldMut<'w> {
/// when DROP is true removed components will be dropped otherwise they will be forgotten
// We use a const generic here so that we are less reliant on
// inlining for rustc to optimize out the `match DROP`
#[allow(clippy::too_many_arguments)]
unsafe fn move_entity_from_remove<const DROP: bool>(
entity: Entity,
self_location: &mut EntityLocation,
Expand Down Expand Up @@ -1826,7 +1825,6 @@ impl<'w> EntityWorldMut<'w> {
///
/// # Safety
/// - A `BundleInfo` with the corresponding `BundleId` must have been initialized.
#[allow(clippy::too_many_arguments)]
unsafe fn remove_bundle(&mut self, bundle: BundleId) -> EntityLocation {
let entity = self.entity;
let world = &mut self.world;
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_gizmos/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ where
}
}

#[allow(clippy::too_many_arguments)]
fn draw_grid<Config, Clear>(
gizmos: &mut GizmoBuffer<Config, Clear>,
isometry: Isometry3d,
Expand Down
3 changes: 0 additions & 3 deletions crates/bevy_gizmos/src/pipeline_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ type DrawLineJointGizmo2d = (
DrawLineJointGizmo,
);

#[allow(clippy::too_many_arguments)]
fn queue_line_gizmos_2d(
draw_functions: Res<DrawFunctions<Transparent2d>>,
pipeline: Res<LineGizmoPipeline>,
Expand Down Expand Up @@ -365,8 +364,6 @@ fn queue_line_gizmos_2d(
}
}
}

#[allow(clippy::too_many_arguments)]
fn queue_line_joint_gizmos_2d(
draw_functions: Res<DrawFunctions<Transparent2d>>,
pipeline: Res<LineJointGizmoPipeline>,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_gizmos/src/pipeline_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ type DrawLineJointGizmo3d = (
DrawLineJointGizmo,
);

#[allow(clippy::too_many_arguments)]
fn queue_line_gizmos_3d(
draw_functions: Res<DrawFunctions<Transparent3d>>,
pipeline: Res<LineGizmoPipeline>,
Expand Down Expand Up @@ -398,7 +397,6 @@ fn queue_line_gizmos_3d(
}
}

#[allow(clippy::too_many_arguments)]
fn queue_line_joint_gizmos_3d(
draw_functions: Res<DrawFunctions<Transparent3d>>,
pipeline: Res<LineJointGizmoPipeline>,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ fn warn_on_differing_texture_transforms(
}

/// Loads a glTF node.
#[allow(clippy::too_many_arguments, clippy::result_large_err)]
#[allow(clippy::result_large_err)]
fn load_node(
gltf_node: &Node,
world_builder: &mut WorldChildBuilder,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_pbr/src/cluster/assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ impl ClusterableObjectType {
}

// NOTE: Run this before update_point_light_frusta!
#[allow(clippy::too_many_arguments)]
pub(crate) fn assign_objects_to_clusters(
mut commands: Commands,
mut global_clusterable_objects: ResMut<GlobalVisibleClusterableObjects>,
Expand Down Expand Up @@ -842,7 +841,6 @@ pub(crate) fn assign_objects_to_clusters(
}
}

#[allow(clippy::too_many_arguments)]
fn compute_aabb_for_cluster(
z_near: f32,
z_far: f32,
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_pbr/src/light/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,6 @@ pub fn check_dir_light_mesh_visibility(
});
}

#[allow(clippy::too_many_arguments)]
pub fn check_point_light_mesh_visibility(
visible_point_lights: Query<&VisibleClusterableObjects>,
mut point_lights: Query<(
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ pub fn extract_mesh_materials<M: Material>(

/// For each view, iterates over all the meshes visible from that view and adds
/// them to [`BinnedRenderPhase`]s or [`SortedRenderPhase`]s as appropriate.
#[allow(clippy::too_many_arguments)]
pub fn queue_material_meshes<M: Material>(
(
opaque_draw_functions,
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_pbr/src/meshlet/from_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ fn split_simplified_group_into_new_meshlets(
new_meshlets_count
}

#[allow(clippy::too_many_arguments)]
fn build_and_compress_per_meshlet_vertex_data(
meshlet: &meshopt_Meshlet,
meshlet_vertex_ids: &[u32],
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_pbr/src/meshlet/instance_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ impl InstanceManager {
}
}

#[allow(clippy::too_many_arguments)]
pub fn add_instance(
&mut self,
instance: MainEntity,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_pbr/src/meshlet/material_pipeline_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub struct MeshletViewMaterialsMainOpaquePass(pub Vec<(u32, CachedRenderPipeline

/// Prepare [`Material`] pipelines for [`super::MeshletMesh`] entities for use in [`super::MeshletMainOpaquePass3dNode`],
/// and register the material with [`InstanceManager`].
#[allow(clippy::too_many_arguments)]
pub fn prepare_material_meshlet_meshes_main_opaque_pass<M: Material>(
resource_manager: ResMut<ResourceManager>,
mut instance_manager: ResMut<InstanceManager>,
Expand Down Expand Up @@ -247,7 +246,6 @@ pub struct MeshletViewMaterialsDeferredGBufferPrepass(

/// Prepare [`Material`] pipelines for [`super::MeshletMesh`] entities for use in [`super::MeshletPrepassNode`],
/// and [`super::MeshletDeferredGBufferPrepassNode`] and register the material with [`InstanceManager`].
#[allow(clippy::too_many_arguments)]
pub fn prepare_material_meshlet_meshes_prepass<M: Material>(
resource_manager: ResMut<ResourceManager>,
mut instance_manager: ResMut<InstanceManager>,
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_pbr/src/meshlet/resource_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ pub fn prepare_meshlet_per_frame_resources(
}
}

#[allow(clippy::too_many_arguments)]
pub fn prepare_meshlet_view_bind_groups(
meshlet_mesh_manager: Res<MeshletMeshManager>,
resource_manager: Res<ResourceManager>,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ fn fill_cluster_buffers_pass(
);
}

#[allow(clippy::too_many_arguments)]
fn cull_pass(
label: &'static str,
render_context: &mut RenderContext,
Expand Down Expand Up @@ -405,7 +404,6 @@ fn cull_pass(
}
}

#[allow(clippy::too_many_arguments)]
fn raster_pass(
first_pass: bool,
render_context: &mut RenderContext,
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_pbr/src/prepass/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,6 @@ pub fn prepare_prepass_view_bind_group<M: Material>(
}
}

#[allow(clippy::too_many_arguments)]
pub fn queue_prepass_material_meshes<M: Material>(
(
opaque_draw_functions,
Expand Down
3 changes: 0 additions & 3 deletions crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ impl FromWorld for ShadowSamplers {
}
}

#[allow(clippy::too_many_arguments)]
pub fn extract_lights(
mut commands: Commands,
point_light_shadow_map: Extract<Res<PointLightShadowMap>>,
Expand Down Expand Up @@ -684,7 +683,6 @@ pub(crate) fn spot_light_clip_from_view(angle: f32, near_z: f32) -> Mat4 {
Mat4::perspective_infinite_reverse_rh(angle * 2.0, 1.0, near_z)
}

#[allow(clippy::too_many_arguments)]
pub fn prepare_lights(
mut commands: Commands,
mut texture_cache: ResMut<TextureCache>,
Expand Down Expand Up @@ -1532,7 +1530,6 @@ fn despawn_entities(commands: &mut Commands, entities: Vec<Entity>) {
/// For each shadow cascade, iterates over all the meshes "visible" from it and
/// adds them to [`BinnedRenderPhase`]s or [`SortedRenderPhase`]s as
/// appropriate.
#[allow(clippy::too_many_arguments)]
pub fn queue_shadows<M: Material>(
shadow_draw_functions: Res<DrawFunctions<Shadow>>,
prepass_pipeline: Res<PrepassPipeline<M>>,
Expand Down
Loading

0 comments on commit 3742e62

Please sign in to comment.