
# 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.
50 lines
1.1 KiB
Rust
50 lines
1.1 KiB
Rust
#![allow(clippy::type_complexity)]
|
|
|
|
mod bundle;
|
|
mod dynamic_scene;
|
|
mod dynamic_scene_builder;
|
|
mod scene;
|
|
mod scene_loader;
|
|
mod scene_spawner;
|
|
|
|
#[cfg(feature = "serialize")]
|
|
pub mod serde;
|
|
|
|
pub use bundle::*;
|
|
pub use dynamic_scene::*;
|
|
pub use dynamic_scene_builder::*;
|
|
pub use scene::*;
|
|
pub use scene_loader::*;
|
|
pub use scene_spawner::*;
|
|
|
|
pub mod prelude {
|
|
#[doc(hidden)]
|
|
pub use crate::{
|
|
DynamicScene, DynamicSceneBuilder, DynamicSceneBundle, Scene, SceneBundle, SceneSpawner,
|
|
};
|
|
}
|
|
|
|
use bevy_app::prelude::*;
|
|
use bevy_asset::AddAsset;
|
|
|
|
#[derive(Default)]
|
|
pub struct ScenePlugin;
|
|
|
|
#[cfg(feature = "serialize")]
|
|
impl Plugin for ScenePlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.add_asset::<DynamicScene>()
|
|
.add_asset::<Scene>()
|
|
.init_asset_loader::<SceneLoader>()
|
|
.init_resource::<SceneSpawner>()
|
|
.add_systems(Update, scene_spawner_system)
|
|
// Systems `*_bundle_spawner` must run before `scene_spawner_system`
|
|
.add_systems(PreUpdate, scene_spawner);
|
|
}
|
|
}
|
|
|
|
#[cfg(not(feature = "serialize"))]
|
|
impl Plugin for ScenePlugin {
|
|
fn build(&self, _: &mut App) {}
|
|
}
|