Suppress the clippy::type_complexity lint (#8313)

# Objective

The clippy lint `type_complexity` is known not to play well with bevy.
It frequently triggers when writing complex queries, and taking the
lint's advice of using a type alias almost always just obfuscates the
code with no benefit. Because of this, this lint is currently ignored in
CI, but unfortunately it still shows up when viewing bevy code in an
IDE.

As someone who's made a fair amount of pull requests to this repo, I
will say that this issue has been a consistent thorn in my side. Since
bevy code is filled with spurious, ignorable warnings, it can be very
difficult to spot the *real* warnings that must be fixed -- most of the
time I just ignore all warnings, only to later find out that one of them
was real after I'm done when CI runs.

## Solution

Suppress this lint in all bevy crates. This was previously attempted in
#7050, but the review process ended up making it more complicated than
it needs to be and landed on a subpar solution.

The discussion in https://github.com/rust-lang/rust-clippy/pull/10571
explores some better long-term solutions to this problem. Since there is
no timeline on when these solutions may land, we should resolve this
issue in the meantime by locally suppressing these lints.

### Unresolved issues

Currently, these lints are not suppressed in our examples, since that
would require suppressing the lint in every single source file. They are
still ignored in CI.
This commit is contained in:
JoJoJet 2023-04-06 17:27:36 -04:00 committed by GitHub
parent b8b0942f49
commit 3ead10a3e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 57 additions and 1 deletions

View file

@ -1,6 +1,7 @@
//! Accessibility for Bevy
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
#![forbid(unsafe_code)]
use std::{

View file

@ -1,6 +1,7 @@
//! Animation for the game engine Bevy
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
use std::ops::Deref;
use std::time::Duration;

View file

@ -1,6 +1,7 @@
//! This crate is about everything concerning the highest-level, application layer of a Bevy app.
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
mod app;
mod main_schedule;

View file

@ -9,6 +9,7 @@
//! [asset storage]: struct.Assets.html
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
mod asset_server;
mod assets;

View file

@ -20,6 +20,7 @@
//! ```
#![forbid(unsafe_code)]
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
mod audio;

View file

@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
//! This crate provides core functionality for Bevy Engine.
mod name;

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
pub mod blit;
pub mod bloom;
pub mod clear_color;

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
extern crate proc_macro;
mod app_plugin;

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
mod diagnostic;
mod entity_count_diagnostics_plugin;
mod frame_time_diagnostics_plugin;

View file

@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
#![allow(clippy::single_component_path_imports)]
//! Forces dynamic linking of Bevy.

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
mod loader;
pub use loader::*;

View file

@ -1,4 +1,5 @@
#![warn(clippy::undocumented_unsafe_blocks)]
#![allow(clippy::type_complexity)]
#![doc = include_str!("../README.md")]
#[cfg(target_pointer_width = "16")]

View file

@ -1 +1,3 @@
#![allow(clippy::type_complexity)]
// Nothing here, check out the integration tests

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
use bevy_macro_utils::BevyManifest;
use encase_derive_impl::{implement, syn};

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
mod converter;
mod gilrs_system;

View file

@ -1,3 +1,4 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
//! This crate adds an immediate mode drawing api to Bevy for visual debugging.

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
#[cfg(feature = "bevy_animation")]
use bevy_animation::AnimationClip;
use bevy_utils::HashMap;

View file

@ -1,3 +1,4 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
//! `bevy_hierarchy` can be used to define hierarchies of entities.
//!

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
mod axis;
/// Common run conditions
pub mod common_conditions;

View file

@ -1,3 +1,4 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
//! This module is separated into its own crate to enable simple dynamic linking for Bevy, and should not be used directly

View file

@ -1,3 +1,4 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
//! This crate provides logging functions and configuration for [Bevy](https://bevyengine.org)
//! apps, and automatically configures platform specific log handlers (i.e. WASM or Android).

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
extern crate proc_macro;
mod attrs;

View file

@ -4,6 +4,7 @@
//! matrices like [`Mat2`], [`Mat3`] and [`Mat4`] and orientation representations
//! like [`Quat`].
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
pub mod cubic_splines;

View file

@ -1,3 +1,4 @@
#![allow(clippy::type_complexity)]
#![allow(clippy::all)]
use glam::{Vec2, Vec3};

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
pub mod wireframe;
mod alpha;

View file

@ -1,6 +1,7 @@
#![doc = include_str!("../README.md")]
#![no_std]
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
use core::fmt::{self, Formatter, Pointer};
use core::{

View file

@ -435,6 +435,7 @@
//! [orphan rule]: https://doc.rust-lang.org/book/ch10-02-traits.html#implementing-a-trait-on-a-type:~:text=But%20we%20can%E2%80%99t,implementation%20to%20use.
//! [`bevy_reflect_derive/documentation`]: bevy_reflect_derive
//! [derive `Reflect`]: derive@crate::Reflect
#![allow(clippy::type_complexity)]
mod array;
mod fields;

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
#[cfg(target_pointer_width = "16")]
compile_error!("bevy_render cannot compile for a 16-bit platform.");

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
mod bundle;
mod dynamic_scene;
mod dynamic_scene_builder;

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
mod bundle;
mod dynamic_texture_atlas_builder;
mod mesh2d;

View file

@ -1,4 +1,5 @@
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
#![doc = include_str!("../README.md")]
mod slice;

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
mod error;
mod font;
mod font_atlas;

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
/// Common run conditions
pub mod common_conditions;
pub mod fixed_timestep;

View file

@ -1,3 +1,4 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![doc = include_str!("../README.md")]

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
//! This crate contains Bevy's UI system, which can be used to create UI for both 2D and 3D games
//! # Basic usage
//! Spawn UI elements with [`node_bundles::ButtonBundle`], [`node_bundles::ImageBundle`], [`node_bundles::TextBundle`] and [`node_bundles::NodeBundle`]

View file

@ -1,7 +1,8 @@
//! General utilities for first-party [Bevy] engine crates.
//!
//! [Bevy]: https://bevyengine.org/
//!
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
#![warn(clippy::undocumented_unsafe_blocks)]

View file

@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]
#[warn(missing_docs)]
mod cursor;
mod event;

View file

@ -1,3 +1,4 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
//! `bevy_winit` provides utilities to handle window creation and the eventloop through [`winit`]
//!