Skip to content

Fix nightly clippy lints - #25756

Open
beicause wants to merge 9 commits into
bevyengine:mainfrom
beicause:fix/nightly-cache-warnings
Open

beicause wants to merge 9 commits into
bevyengine:mainfrom
beicause:fix/nightly-cache-warnings

Conversation

@beicause

@beicause beicause commented Sep 11, 2026

Copy link
Copy Markdown
Member

Objective

Fixes the errors and warnings reported by the nightly jobs of the Update Actions Caches and validation jobs workflows.

Solution

  • Raise the recursion limit in the three crates that hold wgpu handles (bevy_render, bevy_pbr, bevy_solari) via #![recursion_limit = "256"], each with a TODO to remove it once wgpu fixs it.
  • Adding [lints] workspace = true to the packages that were missing it to fix cargo::missing_lints_inheritance, and fix what the inherited lints then report (e.g. missing_docs in the empty compile_fail stubs).
  • Fix the rustc and clippy findings across the workspace:
    • redundant_else in bevy_tasks' task pool tests.
    • deprecated std::f32::INFINITY in bevy_shape, caused by use core::f32; shadowing the primitive.
    • match_same_arms, redundant_closure, doc_markdown, missing_docs, unused_qualifications and semicolon_if_nothing_returned in bevy_scene and the large_scenes examples.
    • print_stdout in the large_scenes examples: these messages are diagnostics, so they now go through info!.
    • allow_attributes / allow_attributes_without_reason in the examples/large_scenes.
  • Remove some cargo::unused_dependencies
Removed `cargo::unused_dependencies` list
# Crate Dependency Action Reason
1 bevy_mesh bevy_encase_derive Deleted No reference in the crate. morph.rs derives encase::ShaderType from the direct dep encase = "0.12"; this proc-macro is used only by bevy_render (3 sites).
2 bevy_scene bevy_log Deleted No reference at all (no warn!/info! either).
3 bevy_text sys-locale Deleted No reference, and no feature wires it up.
4 errors bevy Deleted lib.rs only declares B0001-B0004; bevy is unused, so the whole [dependencies] table was removed.
5 benches criterion Kept (FP) Used only by the bench targets (benches/bevy_*/main.rs), which this lint explicitly does not inspect.
6 benches seq-macro Kept (FP) Same as above; used only in benches/bevy_ecs/world/world_get.rs.
7 bevy_tasks atomic-waker Kept (FP) Used only under the edge_executor feature.
8 bevy_tasks crossbeam-queue Kept (FP) Used only under the edge_executor feature.
9 bevy_solari bevy_anti_alias Kept (FP) Used conditionally.
10 bevy_clipboard bevy_log Kept (FP) Used in the negated cfg(system_clipboard) branch.
11 bevy_platform critical-section Kept (FP) Used only under cfg(not(feature = "std")).
12 bevy_platform spin Kept (FP) Used only under cfg(not(feature = "std")).
13 bevy_anti_alias dlss_wgpu Kept (FP) Only effective on Windows.
14 bevy_reflect inventory Kept (FP) Used only in the auto_register_inventory branch; that feature is a default, so the dependency must not be removed.
15 bevy_image ruzstd Kept (FP) Needs ktx2 enabled too, otherwise ktx2.rs is not compiled at all.
16 bevy_diagnostic sysinfo Kept (FP) Declared in two target-specific tables; cargo cannot match them up.

Testing

cargo +nightly clippy --workspace --all-features --all-targets -- -D warnings

Remaining, deliberately unaddressed:

  • cargo::non_kebab_case_bins warnings for bevy_city, caldera_hotel and bevy_mobile_example. The lints.cargo is unstable and cannot be configured from a stable cargo
  • cargo::unused_dependencies warnings are mostly false positives from #[cfg]-gated dependencies, and it's unstable, too.

This is AI-assisted.

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.
@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy C-Code-Quality A section of code that is hard to understand or change X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples and removed D-Trivial Nice and easy! A great choice to get started with Bevy labels Sep 11, 2026
@alice-i-cecile

Copy link
Copy Markdown
Member

This is AI-assisted.

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 alice-i-cecile added A-Cross-Cutting Impacts the entire engine S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 11, 2026

@mockersf mockersf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't want to chase nightly lints, this was a mistake on my side

the workflows should allow those

@beicause

Copy link
Copy Markdown
Member Author

we don't want to chase nightly lints, this was a mistake on my side

the workflows should allow those

I think that could be a separate PR. The changes in this PR is reasonable imo.

@alice-i-cecile

Copy link
Copy Markdown
Member

I agree that we shouldn't be chasing nightly lints but I also share @beicause's sentiment that these particular changes are good!

@mockersf

Copy link
Copy Markdown
Member

I don't, in particular recursion_limit. I would rather not change that as it works on stable rust, so having an issue in nightly is a rust issue, not a wgpu or Bevy problem

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Contentious There are nontrivial implications that should be thought through and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Cross-Cutting Impacts the entire engine C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Contentious There are nontrivial implications that should be thought through

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants