Skip to content

Commit

Permalink
Allow clippy::type_complexity in more places.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Sep 14, 2023
1 parent 72b8f47 commit 807faf7
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 4 deletions.
2 changes: 2 additions & 0 deletions crates/bevy_asset/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::type_complexity)]

pub mod io;
pub mod meta;
pub mod processor;
Expand Down
3 changes: 1 addition & 2 deletions docs/linters.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ cargo fmt --all
Can be automatically run with [`cargo run -p ci`](../tools/ci) (which also runs other checks) or manually with this command:

```bash
cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::type_complexity -A clippy::manual-strip
cargo clippy --workspace --all-targets --all-features -- -D warnings
```

Explanation:

* `-D warnings`: No warnings are allowed in the codebase.
* `-A clippy::type_complexity`: type complexity must be ignored because we use huge templates for queries.

## [super-linter](https://github.com/github/super-linter)

Expand Down
4 changes: 4 additions & 0 deletions examples/3d/anti_aliasing.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! 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 alias tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]

use std::f32::consts::PI;

use bevy::{
Expand Down
4 changes: 4 additions & 0 deletions examples/3d/shadow_caster_receiver.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! 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 alias tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]

use std::f32::consts::PI;

use bevy::{
Expand Down
4 changes: 4 additions & 0 deletions examples/3d/ssao.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! A scene showcasing screen space ambient occlusion.
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type alias tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]

use bevy::{
core_pipeline::experimental::taa::{TemporalAntiAliasBundle, TemporalAntiAliasPlugin},
pbr::{
Expand Down
4 changes: 4 additions & 0 deletions examples/ecs/custom_query_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
//!
//! 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 alias 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;

Expand Down
4 changes: 4 additions & 0 deletions examples/ecs/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
//!
//! 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 alias tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]

use bevy::prelude::*;

fn main() {
Expand Down
4 changes: 4 additions & 0 deletions examples/games/alien_cake_addict.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! 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 alias tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]

use std::f32::consts::PI;

use bevy::prelude::*;
Expand Down
4 changes: 4 additions & 0 deletions examples/games/game_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
//! 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 alias 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);
Expand Down
4 changes: 4 additions & 0 deletions examples/input/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
//! 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 alias tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]

use bevy::{input::keyboard::KeyboardInput, prelude::*};

fn main() {
Expand Down
4 changes: 4 additions & 0 deletions examples/mobile/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type alias tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]

use bevy::{input::touch::TouchPhase, prelude::*, window::WindowMode};

// the `bevy_main` proc_macro generates the required boilerplate for iOS and Android
Expand Down
4 changes: 4 additions & 0 deletions examples/tools/scene_viewer/scene_viewer_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
//! - 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 alias 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,
Expand Down
4 changes: 4 additions & 0 deletions examples/ui/button.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//! 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 alias tends to obfuscate code while offering no improvement in code cleanliness.
#![allow(clippy::type_complexity)]

use bevy::{prelude::*, winit::WinitSettings};

fn main() {
Expand Down
3 changes: 1 addition & 2 deletions tools/ci/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ bitflags! {
}
}

const CLIPPY_FLAGS: [&str; 8] = [
"-Aclippy::type_complexity",
const CLIPPY_FLAGS: [&str; 7] = [
"-Aclippy::explicit_iter_loop",
"-Wclippy::doc_markdown",
"-Wclippy::redundant_else",
Expand Down

0 comments on commit 807faf7

Please sign in to comment.