
# 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.
57 lines
1.8 KiB
Rust
57 lines
1.8 KiB
Rust
#![warn(missing_docs)]
|
|
#![allow(clippy::type_complexity)]
|
|
#![allow(clippy::single_component_path_imports)]
|
|
|
|
//! Forces dynamic linking of Bevy.
|
|
//!
|
|
//! Dynamic linking causes Bevy to be built and linked as a dynamic library. This will make
|
|
//! incremental builds compile much faster.
|
|
//!
|
|
//! # Warning
|
|
//!
|
|
//! Do not enable this feature for release builds because this would require you to ship
|
|
//! `libstd.so` and `libbevy_dylib.so` with your game.
|
|
//!
|
|
//! # Enabling dynamic linking
|
|
//!
|
|
//! ## The recommended way
|
|
//!
|
|
//! The easiest way to enable dynamic linking is to use the `--features bevy/dynamic_linking` flag when
|
|
//! using the `cargo run` command:
|
|
//!
|
|
//! `cargo run --features bevy/dynamic_linking`
|
|
//!
|
|
//! ## The unrecommended way
|
|
//!
|
|
//! It is also possible to enable the `dynamic_linking` feature inside of the `Cargo.toml` file. This is
|
|
//! unrecommended because it requires you to remove this feature every time you want to create a
|
|
//! release build to avoid having to ship additional files with your game.
|
|
//!
|
|
//! To enable dynamic linking inside of the `Cargo.toml` file add the `dynamic_linking` feature to the
|
|
//! bevy dependency:
|
|
//!
|
|
//! `features = ["dynamic_linking"]`
|
|
//!
|
|
//! ## The manual way
|
|
//!
|
|
//! Manually enabling dynamic linking is achieved by adding `bevy_dylib` as a dependency and
|
|
//! adding the following code to the `main.rs` file:
|
|
//!
|
|
//! ```
|
|
//! #[allow(unused_imports)]
|
|
//! use bevy_dylib;
|
|
//! ```
|
|
//!
|
|
//! It is recommended to disable the `bevy_dylib` dependency in release mode by adding the
|
|
//! following code to the `use` statement to avoid having to ship additional files with your game:
|
|
//!
|
|
//! ```
|
|
//! #[allow(unused_imports)]
|
|
//! #[cfg(debug_assertions)] // new
|
|
//! use bevy_dylib;
|
|
//! ```
|
|
|
|
// Force linking of the main bevy crate
|
|
#[allow(unused_imports)]
|
|
use bevy_internal;
|