Fix nightly clippy lints - #25756
Open
beicause wants to merge 9 commits into
Open
Fix nightly clippy lints#25756beicause wants to merge 9 commits into
beicause wants to merge 9 commits into
Conversation
The cache workflow reported nine packages without a `[lints]` table while `workspace.lints` is present: the four `large_scenes` examples (fixed in the previous commit) plus `bevy_scene/macros`, the three `*/compile_fail` crates, and `tools/compile_fail_utils`. Add `[lints] workspace = true` to those five packages and fix what the inherited lints then report: - `missing_docs`: document the empty `compile_fail` stubs and `compile_fail_utils`, and the integration test entry points. The `mipmap_generator` helper library and the `bistro`/`caldera_hotel` binaries keep an `expect(missing_docs)`, since documenting their whole API is not useful for examples. - `unused_qualifications`: drop the redundant paths in `bevy_scene/macros` and `compile_fail_utils`' tests. - `unused_dependencies`: the compile-fail crates only use their Bevy dependency from `tests/`, so move it to `[dev-dependencies]`. Making the `bistro`/`caldera_hotel` items private surfaced dead code, which is removed as well: `all_children` was only ever self-recursive, and `caldera_hotel` did not use its `mipmap_generator` dependency at all.
Run with `cargo +nightly clippy --package bevy --all-targets --all-features -- -Dwarnings`, matching how CI invokes clippy. - `redundant_else` in `bevy_ecs` (query iteration and reflect bundle). - `unnecessary_get_before_div` in `BatchedUniformBuffer`, and a needless `if`/`return true`/`false` in the post-process bind group cache. - `redundant_closure`, `match_same_arms`, `semicolon_if_nothing_returned` and a `doc_markdown` miss in `bevy_scene/macros`. - Deprecated `std::f32::MAX`: `from_mesh.rs` imports the `core::f32` module, which shadows the `f32` primitive and makes `f32::MAX` resolve to the deprecated module constant. Drop that import so `f32::MAX` works. Raising the recursion limit is needed for `bevy_pbr` and `bevy_solari` too, since both hold `wgpu` handles; see the TODO on the attribute.
The `cargo::` lints are nightly-only, so stable cargo cannot act on `[workspace.lints.cargo]`. The `bevy_city`, `caldera_hotel` and `bevy_mobile_example` binaries keep their names; the lint is left unaddressed rather than renaming binaries that build scripts, the Xcode project and CI refer to.
`cargo +nightly clippy --workspace --all-features --all-targets -- -D warnings` (how CI runs clippy) either failed or emitted warnings. Fixing the earlier `-p bevy` errors was not enough: with `--all-targets` clippy also lints test and example code, which surfaced more findings. - `redundant_else` in `bevy_tasks`' task pool tests. - `match_same_arms` / `let_and_return` style cleanups in `bevy_scene`, `bevy_city` and `mipmap_generator`. - `unused_qualifications` and deprecated `f32::INFINITY` in `bevy_shape`, caused by `use core::f32;` shadowing the primitive. - `doc_markdown` in the `large_scenes` examples. - `semicolon_if_nothing_returned` for assignment tails in `bistro` and `caldera_hotel`. - `print_stdout` in the examples: these messages are diagnostics, so route them through `info!` instead. - `allow_attributes` and `allow_attributes_without_reason`: turn the examples' `#[allow]`s into `#[expect(..., reason = "...")]`, and use `#[cfg_attr(not(feature = "compress"), expect(...))]` for the mipmap generator's conditionally-used bindings.
`cargo::unused_dependencies` flags several declared dependencies that no target uses. Remove the ones that are really unused: - `bevy_encase_derive` from `bevy_mesh`: the `morph` code derives `encase::ShaderType` from the `encase` crate (a direct dependency), and `bevy_encase_derive` is only used by `bevy_render`. - `bevy_log` from `bevy_scene`, `sys-locale` from `bevy_text`, and `bevy` from `errors`, none of which reference them.
Member
Can you say a bit more about how you used AI in this fix? I don't mind if the answer here was "I told the model to fix all the nightly lints and then verified the results", but this is helpful context for reviwers. |
alice-i-cecile
approved these changes
Sep 11, 2026
mockersf
requested changes
Sep 16, 2026
Member
Author
I think that could be a separate PR. The changes in this PR is reasonable imo. |
Member
|
I agree that we shouldn't be chasing nightly lints but I also share @beicause's sentiment that these particular changes are good! |
Member
|
I don't, in particular |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Fixes the errors and warnings reported by the nightly jobs of the Update Actions Caches and validation jobs workflows.
Solution
wgpuhandles (bevy_render,bevy_pbr,bevy_solari) via#![recursion_limit = "256"], each with aTODOto remove it once wgpu fixs it.[lints] workspace = trueto the packages that were missing it to fixcargo::missing_lints_inheritance, and fix what the inherited lints then report (e.g.missing_docsin the emptycompile_failstubs).redundant_elseinbevy_tasks' task pool tests.std::f32::INFINITYinbevy_shape, caused byuse core::f32;shadowing the primitive.match_same_arms,redundant_closure,doc_markdown,missing_docs,unused_qualificationsandsemicolon_if_nothing_returnedinbevy_sceneand thelarge_scenesexamples.print_stdoutin thelarge_scenesexamples: these messages are diagnostics, so they now go throughinfo!.allow_attributes/allow_attributes_without_reasonin theexamples/large_scenes.cargo::unused_dependenciesRemoved `cargo::unused_dependencies` list
bevy_meshbevy_encase_derivemorph.rsderivesencase::ShaderTypefrom the direct depencase = "0.12"; this proc-macro is used only bybevy_render(3 sites).bevy_scenebevy_logwarn!/info!either).bevy_textsys-localeerrorsbevylib.rsonly declaresB0001-B0004;bevyis unused, so the whole[dependencies]table was removed.benchescriterionbenches/bevy_*/main.rs), which this lint explicitly does not inspect.benchesseq-macrobenches/bevy_ecs/world/world_get.rs.bevy_tasksatomic-wakeredge_executorfeature.bevy_taskscrossbeam-queueedge_executorfeature.bevy_solaribevy_anti_aliasbevy_clipboardbevy_logcfg(system_clipboard)branch.bevy_platformcritical-sectioncfg(not(feature = "std")).bevy_platformspincfg(not(feature = "std")).bevy_anti_aliasdlss_wgpubevy_reflectinventoryauto_register_inventorybranch; that feature is a default, so the dependency must not be removed.bevy_imageruzstdktx2enabled too, otherwisektx2.rsis not compiled at all.bevy_diagnosticsysinfoTesting
cargo +nightly clippy --workspace --all-features --all-targets -- -D warningsRemaining, deliberately unaddressed:
cargo::non_kebab_case_binswarnings forbevy_city,caldera_hotelandbevy_mobile_example. Thelints.cargois unstable and cannot be configured from a stable cargocargo::unused_dependencieswarnings are mostly false positives from#[cfg]-gated dependencies, and it's unstable, too.This is AI-assisted.