Skip to content

Commit

Permalink
Add [lints] table, fix adding #![allow(clippy::type_complexity)] ev…
Browse files Browse the repository at this point in the history
…erywhere (bevyengine#10011)

# Objective

- Fix adding `#![allow(clippy::type_complexity)]` everywhere. like bevyengine#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>
  • Loading branch information
2 people authored and Ray Redondo committed Jan 9, 2024
1 parent 367ec8a commit f7c2115
Show file tree
Hide file tree
Showing 95 changed files with 137 additions and 102 deletions.
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -29,6 +29,12 @@ members = [
"errors",
]

[workspace.lints.clippy]
type_complexity = "allow"

[lints]
workspace = true

[features]
default = [
"animation",
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_a11y/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion crates/bevy_a11y/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Accessibility for Bevy

#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
#![forbid(unsafe_code)]

use std::sync::{
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_animation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ downcast-rs = "1.2.0"
wasm-bindgen = { version = "0.2" }
web-sys = { version = "0.3", features = [ "Window" ] }

[lints]
workspace = true
1 change: 0 additions & 1 deletion crates/bevy_app/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions crates/bevy_asset/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions crates/bevy_asset/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::type_complexity)]

pub mod io;
pub mod meta;
pub mod processor;
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_audio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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
1 change: 0 additions & 1 deletion crates/bevy_audio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
//! ```

#![forbid(unsafe_code)]
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]

mod audio;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ serialize = ["dep:serde"]

[dev-dependencies]
crossbeam-channel = "0.5.0"

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/bevy_core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]

//! This crate provides core functionality for Bevy Engine.

mod name;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_core_pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions crates/bevy_core_pipeline/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::type_complexity)]

pub mod blit;
pub mod bloom;
pub mod clear_color;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions crates/bevy_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::type_complexity)]

extern crate proc_macro;

mod app_plugin;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_diagnostic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions crates/bevy_diagnostic/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::type_complexity)]

mod diagnostic;
mod entity_count_diagnostics_plugin;
mod frame_time_diagnostics_plugin;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_dylib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ crate-type = ["dylib"]

[dependencies]
bevy_internal = { path = "../bevy_internal", version = "0.12.0", default-features = false }

[lints]
workspace = true
1 change: 0 additions & 1 deletion crates/bevy_dylib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
#![allow(clippy::single_component_path_imports)]

//! Forces dynamic linking of Bevy.
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_dynamic_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ bevy_app = { path = "../bevy_app", version = "0.12.0" }
# other
libloading = { version = "0.8" }
thiserror = "1.0"

[lints]
workspace = true
2 changes: 0 additions & 2 deletions crates/bevy_dynamic_plugin/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::type_complexity)]

mod loader;

pub use loader::*;
3 changes: 3 additions & 0 deletions crates/bevy_ecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ path = "examples/resources.rs"
[[example]]
name = "change_detection"
path = "examples/change_detection.rs"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bevy_ecs/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_ecs_compile_fail_tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
#![allow(clippy::type_complexity)]

// Nothing here, check out the integration tests
3 changes: 3 additions & 0 deletions crates/bevy_encase_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions crates/bevy_encase_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::type_complexity)]

use bevy_macro_utils::BevyManifest;
use encase_derive_impl::{implement, syn};

Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_gilrs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ bevy_time = { path = "../bevy_time", version = "0.12.0" }
# other
gilrs = "0.10.1"
thiserror = "1.0"

[lints]
workspace = true
1 change: 0 additions & 1 deletion crates/bevy_gilrs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_gizmos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion crates/bevy_gizmos/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]

//! This crate adds an immediate mode drawing api to Bevy for visual debugging.
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_gltf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ base64 = "0.13.0"
percent-encoding = "2.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/bevy_gltf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_hierarchy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion crates/bevy_hierarchy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]
//! `bevy_hierarchy` can be used to define hierarchies of entities.
//!
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_input/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ thiserror = "1.0"

[dev-dependencies]
bevy = { path = "../../", version = "0.12.0" }

[lints]
workspace = true
1 change: 0 additions & 1 deletion crates/bevy_input/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]

//! Input functionality for the [Bevy game engine](https://bevyengine.org/).
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion crates/bevy_internal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion crates/bevy_log/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_macro_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ syn = "2.0"
quote = "1.0"
rustc-hash = "1.0"
proc-macro2 = "1.0"

[lints]
workspace = true
1 change: 0 additions & 1 deletion crates/bevy_macro_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion crates/bevy_math/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//! matrices like [`Mat2`], [`Mat3`] and [`Mat4`] and orientation representations
//! like [`Quat`].

#![allow(clippy::type_complexity)]
#![warn(missing_docs)]

mod affine3;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_mikktspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ glam = "0.24.1"

[[example]]
name = "generate"

[lints]
workspace = true
1 change: 0 additions & 1 deletion crates/bevy_mikktspace/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(clippy::type_complexity)]
#![allow(clippy::all)]

use glam::{Vec2, Vec3};
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_pbr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ radsort = "0.1"
naga_oil = "0.10"
smallvec = "1.6"
thread_local = "1.0"

[lints]
workspace = true
2 changes: 0 additions & 2 deletions crates/bevy_pbr/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::type_complexity)]

pub mod wireframe;

mod alpha;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_ptr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ license = "MIT OR Apache-2.0"
keywords = ["bevy", "no_std"]

[dependencies]

[lints]
workspace = true
1 change: 0 additions & 1 deletion crates/bevy_ptr/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_reflect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ bincode = "1.3"
name = "reflect_docs"
path = "examples/reflect_docs.rs"
required-features = ["documentation"]

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bevy_reflect/bevy_reflect_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit f7c2115

Please sign in to comment.