Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011)

# Objective

- Fix adding `#![allow(clippy::type_complexity)]` everywhere. like #9796

## Solution

- Use the new [lints] table that will land in 1.74
(https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#lints)
- inherit lint to the workspace, crates and examples.
```
[lints]
workspace = true
```

## Changelog

- Bump rust version to 1.74
- Enable lints table for the workspace
```toml
[workspace.lints.clippy]
type_complexity = "allow"
```
- Allow type complexity for all crates and examples
```toml
[lints]
workspace = true
```

---------

Co-authored-by: Martín Maita <47983254+mnmaita@users.noreply.github.com>
This commit is contained in:
Ame 2023-11-18 14:58:48 -06:00 committed by GitHub
parent 9c0fca072d
commit 951c9bb1a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
95 changed files with 137 additions and 102 deletions

View file

@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/bevyengine/bevy"
rust-version = "1.70.0"
rust-version = "1.74.0"
[workspace]
exclude = [
@ -29,6 +29,12 @@ members = [
"errors",
]
[workspace.lints.clippy]
type_complexity = "allow"
[lints]
workspace = true
[features]
default = [
"animation",

View file

@ -15,3 +15,6 @@ bevy_derive = { path = "../bevy_derive", version = "0.12.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0" }
accesskit = "0.12"
[lints]
workspace = true

View file

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

View file

@ -21,3 +21,6 @@ bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0" }
bevy_transform = { path = "../bevy_transform", version = "0.12.0" }
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.12.0" }
[lints]
workspace = true

View file

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

View file

@ -32,3 +32,5 @@ downcast-rs = "1.2.0"
wasm-bindgen = { version = "0.2" }
web-sys = { version = "0.3", features = [ "Window" ] }
[lints]
workspace = true

View file

@ -1,7 +1,6 @@
//! 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

@ -53,3 +53,6 @@ notify-debouncer-full = { version = "0.3.1", optional = true }
[dev-dependencies]
bevy_core = { path = "../bevy_core", version = "0.12.0" }
[lints]
workspace = true

View file

@ -17,3 +17,6 @@ bevy_macro_utils = { path = "../../bevy_macro_utils", version = "0.12.0" }
syn = "2.0"
proc-macro2 = "1.0"
quote = "1.0"
[lints]
workspace = true

View file

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

View file

@ -28,7 +28,6 @@ oboe = { version = "0.5", optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
rodio = { version = "0.17", default-features = false, features = ["wasm-bindgen"] }
[features]
mp3 = ["rodio/mp3"]
flac = ["rodio/flac"]
@ -43,3 +42,6 @@ symphonia-vorbis = ["rodio/symphonia-vorbis"]
symphonia-wav = ["rodio/symphonia-wav"]
# Enable using a shared stdlib for cxx on Android.
android_shared_stdcxx = ["oboe/shared-stdcxx"]
[lints]
workspace = true

View file

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

View file

@ -27,3 +27,6 @@ serialize = ["dep:serde"]
[dev-dependencies]
crossbeam-channel = "0.5.0"
[lints]
workspace = true

View file

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

View file

@ -34,3 +34,6 @@ bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
serde = { version = "1", features = ["derive"] }
bitflags = "2.3"
radsort = "0.1"
[lints]
workspace = true

View file

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

View file

@ -16,3 +16,6 @@ bevy_macro_utils = { path = "../bevy_macro_utils", version = "0.12.0" }
quote = "1.0"
syn = { version = "2.0", features = ["full"] }
[lints]
workspace = true

View file

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

View file

@ -31,3 +31,6 @@ sysinfo = { version = "0.29.0", default-features = false, features = [
# Only include when not bevy_dynamic_plugin and on linux/windows/android
[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "android"))'.dependencies]
sysinfo = { version = "0.29.0", default-features = false }
[lints]
workspace = true

View file

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

View file

@ -13,3 +13,6 @@ crate-type = ["dylib"]
[dependencies]
bevy_internal = { path = "../bevy_internal", version = "0.12.0", default-features = false }
[lints]
workspace = true

View file

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

View file

@ -15,3 +15,6 @@ bevy_app = { path = "../bevy_app", version = "0.12.0" }
# other
libloading = { version = "0.8" }
thiserror = "1.0"
[lints]
workspace = true

View file

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

View file

@ -44,3 +44,6 @@ path = "examples/resources.rs"
[[example]]
name = "change_detection"
path = "examples/change_detection.rs"
[lints]
workspace = true

View file

@ -14,3 +14,6 @@ bevy_macro_utils = { path = "../../bevy_macro_utils", version = "0.12.0" }
syn = "2.0"
quote = "1.0"
proc-macro2 = "1.0"
[lints]
workspace = true

View file

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

View file

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

View file

@ -14,3 +14,6 @@ proc-macro = true
[dependencies]
bevy_macro_utils = { path = "../bevy_macro_utils", version = "0.12.0" }
encase_derive_impl = "0.6.1"
[lints]
workspace = true

View file

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

View file

@ -20,3 +20,6 @@ bevy_time = { path = "../bevy_time", version = "0.12.0" }
# other
gilrs = "0.10.1"
thiserror = "1.0"
[lints]
workspace = true

View file

@ -3,7 +3,6 @@
//! This crate is built on top of [GilRs](gilrs), a library
//! that handles abstracting over platform-specific gamepad APIs.
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
mod converter;

View file

@ -25,3 +25,6 @@ bevy_core = { path = "../bevy_core", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0" }
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.12.0" }
bevy_transform = { path = "../bevy_transform", version = "0.12.0" }
[lints]
workspace = true

View file

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

View file

@ -47,3 +47,6 @@ base64 = "0.13.0"
percent-encoding = "2.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
[lints]
workspace = true

View file

@ -2,7 +2,7 @@
//! for loading glTF 2.0 (a standard 3D scene definition format) files in Bevy.
//!
//! The [glTF 2.0 specification](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html) defines the format of the glTF files.
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
#[cfg(feature = "bevy_animation")]

View file

@ -22,3 +22,6 @@ bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
# other
smallvec = { version = "1.6", features = ["serde", "union", "const_generics"] }
[lints]
workspace = true

View file

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

View file

@ -28,3 +28,6 @@ thiserror = "1.0"
[dev-dependencies]
bevy = { path = "../../", version = "0.12.0" }
[lints]
workspace = true

View file

@ -1,4 +1,3 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
//! Input functionality for the [Bevy game engine](https://bevyengine.org/).

View file

@ -153,3 +153,6 @@ bevy_ui = { path = "../bevy_ui", optional = true, version = "0.12.0" }
bevy_winit = { path = "../bevy_winit", optional = true, version = "0.12.0" }
bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.12.0" }
bevy_gizmos = { path = "../bevy_gizmos", optional = true, version = "0.12.0", default-features = false }
[lints]
workspace = true

View file

@ -1,4 +1,3 @@
#![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

@ -30,3 +30,6 @@ android_log-sys = "0.3.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.6"
tracing-wasm = "0.2.1"
[lints]
workspace = true

View file

@ -1,4 +1,3 @@
#![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

@ -14,3 +14,6 @@ syn = "2.0"
quote = "1.0"
rustc-hash = "1.0"
proc-macro2 = "1.0"
[lints]
workspace = true

View file

@ -1,4 +1,3 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
#![deny(unsafe_code)]
//! A collection of helper types and functions for working on macros within the Bevy ecosystem.

View file

@ -20,3 +20,6 @@ mint = ["glam/mint"]
glam_assert = ["glam/glam-assert"]
# Enable assertions in debug builds to check the validity of parameters passed to glam
debug_glam_assert = ["glam/debug-glam-assert"]
[lints]
workspace = true

View file

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

View file

@ -15,3 +15,6 @@ glam = "0.24.1"
[[example]]
name = "generate"
[lints]
workspace = true

View file

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

View file

@ -35,3 +35,6 @@ radsort = "0.1"
naga_oil = "0.10"
smallvec = "1.6"
thread_local = "1.0"
[lints]
workspace = true

View file

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

View file

@ -9,3 +9,6 @@ license = "MIT OR Apache-2.0"
keywords = ["bevy", "no_std"]
[dependencies]
[lints]
workspace = true

View file

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

View file

@ -47,3 +47,6 @@ bincode = "1.3"
name = "reflect_docs"
path = "examples/reflect_docs.rs"
required-features = ["documentation"]
[lints]
workspace = true

View file

@ -23,3 +23,6 @@ syn = { version = "2.0", features = ["full"] }
proc-macro2 = "1.0"
quote = "1.0"
uuid = { version = "1.1", features = ["v4"] }
[lints]
workspace = true

View file

@ -464,7 +464,6 @@
//! [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

@ -96,3 +96,6 @@ web-sys = { version = "0.3", features = [
'Window',
] }
wasm-bindgen = "0.2"
[lints]
workspace = true

View file

@ -17,3 +17,6 @@ bevy_macro_utils = { path = "../../bevy_macro_utils", version = "0.12.0" }
syn = "2.0"
proc-macro2 = "1.0"
quote = "1.0"
[lints]
workspace = true

View file

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

View file

@ -33,3 +33,6 @@ thiserror = "1.0"
postcard = { version = "1.0", features = ["alloc"] }
bincode = "1.3"
rmp-serde = "1.1"
[lints]
workspace = true

View file

@ -4,7 +4,6 @@
//! instantiated or removed from a world to allow composition. Scenes can be serialized/deserialized,
//! for example to save part of the world state to a file.
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
mod bundle;

View file

@ -35,3 +35,6 @@ thiserror = "1.0"
rectangle-pack = "0.4"
bitflags = "2.3"
radsort = "0.1"
[lints]
workspace = true

View file

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

View file

@ -24,3 +24,6 @@ wasm-bindgen-futures = "0.4"
[dev-dependencies]
instant = { version = "0.1", features = ["wasm-bindgen"] }
[lints]
workspace = true

View file

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

View file

@ -30,3 +30,6 @@ ab_glyph = "0.2.6"
glyph_brush_layout = "0.2.1"
thiserror = "1.0"
serde = {version = "1", features = ["derive"]}
[lints]
workspace = true

View file

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

View file

@ -24,3 +24,6 @@ bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
crossbeam-channel = "0.5.0"
serde = { version = "1", features = ["derive"], optional = true }
thiserror = "1.0"
[lints]
workspace = true

View file

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

View file

@ -25,3 +25,6 @@ glam = { version = "0.24", features = ["approx"] }
[features]
serialize = ["dep:serde", "bevy_math/serialize"]
[lints]
workspace = true

View file

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

View file

@ -36,3 +36,6 @@ serde = { version = "1", features = ["derive"] }
smallvec = { version = "1.6", features = ["union", "const_generics"] }
bytemuck = { version = "1.5", features = ["derive"] }
thiserror = "1.0.0"
[lints]
workspace = true

View file

@ -1,5 +1,3 @@
#![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

@ -24,3 +24,6 @@ nonmax = "0.5"
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2.0", features = ["js"] }
[lints]
workspace = true

View file

@ -12,3 +12,6 @@ proc-macro = true
syn = "2.0"
quote = "1.0"
proc-macro2 = "1.0"
[lints]
workspace = true

View file

@ -2,7 +2,7 @@
//!
//! [Bevy]: https://bevyengine.org/
//!
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
#![warn(clippy::undocumented_unsafe_blocks)]

View file

@ -28,3 +28,6 @@ raw-window-handle = "0.5"
# other
serde = { version = "1.0", features = ["derive"], optional = true }
[lints]
workspace = true

View file

@ -1,4 +1,3 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
//! `bevy_window` provides a platform-agnostic interface for windowing in Bevy.
//!

View file

@ -45,3 +45,6 @@ crossbeam-channel = "0.5"
[package.metadata.docs.rs]
features = ["x11"]
[lints]
workspace = true

View file

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

View file

@ -5,8 +5,6 @@
//!
//! [`Material2d`]: bevy::sprite::Material2d
#![allow(clippy::type_complexity)]
use bevy::{
core_pipeline::core_2d::Transparent2d,
prelude::*,

View file

@ -1,9 +1,5 @@
//! This example compares MSAA (Multi-Sample Anti-aliasing), FXAA (Fast Approximate Anti-aliasing), and TAA (Temporal Anti-aliasing).
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use std::f32::consts::PI;
use bevy::{

View file

@ -1,9 +1,5 @@
//! Demonstrates how to prevent meshes from casting/receiving shadows in a 3d scene.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use std::f32::consts::PI;
use bevy::{

View file

@ -1,9 +1,5 @@
//! A scene showcasing screen space ambient occlusion.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use bevy::{
core_pipeline::experimental::taa::{TemporalAntiAliasBundle, TemporalAntiAliasPlugin},
pbr::{

View file

@ -18,10 +18,6 @@
//! | `D` | Toggle Depth Prepass |
//! | `T` | Toggle TAA |
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use std::f32::consts::PI;
use bevy::{

View file

@ -12,10 +12,6 @@
//!
//! For more details on the `WorldQuery` derive macro, see the trait documentation.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use bevy::{ecs::query::WorldQuery, prelude::*};
use std::fmt::Debug;

View file

@ -5,10 +5,6 @@
//!
//! In this case, we're transitioning from a `Menu` state to an `InGame` state.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use bevy::prelude::*;
fn main() {

View file

@ -1,9 +1,5 @@
//! Eat the cakes. Eat them all. An example 3D game.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use std::f32::consts::PI;
use bevy::prelude::*;

View file

@ -2,10 +2,6 @@
//! change some settings or quit. There is no actual game, it will just display the current
//! settings for 5 seconds before going back to the menu.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use bevy::prelude::*;
const TEXT_COLOR: Color = Color::rgb(0.9, 0.9, 0.9);

View file

@ -4,10 +4,6 @@
//! Clicking toggle IME (Input Method Editor) support, but the font used as limited support of characters.
//! You should change the provided font with another one to test other languages input.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use bevy::{input::keyboard::KeyboardInput, prelude::*};
fn main() {

View file

@ -29,3 +29,5 @@ target_sdk_version = 31
icon = "@mipmap/ic_launcher"
label = "Bevy Example"
[lints]
workspace = true

View file

@ -1,7 +1,3 @@
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use bevy::{
input::touch::TouchPhase,
prelude::*,

View file

@ -3,10 +3,6 @@
//! - Copy the code for the `SceneViewerPlugin` and add the plugin to your App.
//! - Insert an initialized `SceneHandle` resource into your App's `AssetServer`.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use bevy::{
asset::LoadState, gltf::Gltf, input::common_conditions::input_just_pressed, prelude::*,
scene::InstanceId,

View file

@ -1,10 +1,6 @@
//! This example illustrates how to create a button that changes color and text based on its
//! interaction state.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type aliases tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]
use bevy::{prelude::*, winit::WinitSettings};
fn main() {