From f2719f54702563217723d87f79b9cb4678382991 Mon Sep 17 00:00:00 2001 From: Rich Churcher Date: Tue, 17 Dec 2024 10:27:57 +1100 Subject: [PATCH] Rust 1.83, allow -> expect (missing_docs) (#16561) # Objective We were waiting for 1.83 to address most of these, due to a bug with `missing_docs` and `expect`. Relates to, but does not entirely complete, #15059. ## Solution - Upgrade to 1.83 - Switch `allow(missing_docs)` to `expect(missing_docs)` - Remove a few now-unused `allow`s along the way, or convert to `expect` --- Cargo.toml | 2 +- crates/bevy_app/src/lib.rs | 9 +++++++-- crates/bevy_asset/macros/src/lib.rs | 3 +-- crates/bevy_asset/src/lib.rs | 4 +--- crates/bevy_core_pipeline/src/lib.rs | 3 +-- crates/bevy_derive/src/lib.rs | 3 +-- crates/bevy_diagnostic/src/lib.rs | 3 +-- crates/bevy_ecs/macros/src/lib.rs | 3 +-- crates/bevy_ecs/src/lib.rs | 9 +++++++-- crates/bevy_encase_derive/src/lib.rs | 3 +-- crates/bevy_image/src/lib.rs | 3 +-- crates/bevy_math/src/lib.rs | 8 +++++++- crates/bevy_mesh/src/lib.rs | 4 +--- crates/bevy_mikktspace/tests/regression_test.rs | 10 +++------- crates/bevy_pbr/src/lib.rs | 3 +-- crates/bevy_picking/src/backend.rs | 6 ++---- crates/bevy_reflect/src/lib.rs | 12 ++++++++---- crates/bevy_render/macros/src/lib.rs | 3 +-- crates/bevy_render/src/lib.rs | 14 +++++++++----- crates/bevy_sprite/src/lib.rs | 3 +-- crates/bevy_state/macros/src/lib.rs | 3 +-- crates/bevy_state/src/lib.rs | 9 +++++++-- crates/bevy_ui/src/lib.rs | 3 +-- crates/bevy_window/src/event.rs | 3 +-- tests/how_to_test_systems.rs | 2 +- 25 files changed, 67 insertions(+), 61 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fd61ba7985..348e939f00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"] license = "MIT OR Apache-2.0" repository = "https://github.com/bevyengine/bevy" documentation = "https://docs.rs/bevy" -rust-version = "1.82.0" +rust-version = "1.83.0" [workspace] exclude = [ diff --git a/crates/bevy_app/src/lib.rs b/crates/bevy_app/src/lib.rs index aac1cfddff..c7dd7414aa 100644 --- a/crates/bevy_app/src/lib.rs +++ b/crates/bevy_app/src/lib.rs @@ -1,5 +1,10 @@ -// `rustdoc_internals` is needed for `#[doc(fake_variadics)]` -#![allow(internal_features)] +#![cfg_attr( + any(docsrs, docsrs_dep), + expect( + internal_features, + reason = "rustdoc_internals is needed for fake_variadic" + ) +)] #![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))] #![forbid(unsafe_code)] #![doc( diff --git a/crates/bevy_asset/macros/src/lib.rs b/crates/bevy_asset/macros/src/lib.rs index 901afd4c48..443bd09ab9 100644 --- a/crates/bevy_asset/macros/src/lib.rs +++ b/crates/bevy_asset/macros/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] use bevy_macro_utils::BevyManifest; diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index d252946c3c..21e976179e 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -138,9 +138,7 @@ //! If you want to save your assets back to disk, you should implement [`AssetSaver`](saver::AssetSaver) as well. //! This trait mirrors [`AssetLoader`] in structure, and works in tandem with [`AssetWriter`](io::AssetWriter), which mirrors [`AssetReader`](io::AssetReader). -// FIXME(3492): remove once docs are ready -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", diff --git a/crates/bevy_core_pipeline/src/lib.rs b/crates/bevy_core_pipeline/src/lib.rs index 731b50a757..e94daa90f4 100644 --- a/crates/bevy_core_pipeline/src/lib.rs +++ b/crates/bevy_core_pipeline/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![forbid(unsafe_code)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![doc( diff --git a/crates/bevy_derive/src/lib.rs b/crates/bevy_derive/src/lib.rs index a18e7cbd42..2636ffc57d 100644 --- a/crates/bevy_derive/src/lib.rs +++ b/crates/bevy_derive/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![forbid(unsafe_code)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![doc( diff --git a/crates/bevy_diagnostic/src/lib.rs b/crates/bevy_diagnostic/src/lib.rs index 5db2c188b8..e030dde797 100644 --- a/crates/bevy_diagnostic/src/lib.rs +++ b/crates/bevy_diagnostic/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![forbid(unsafe_code)] #![doc( diff --git a/crates/bevy_ecs/macros/src/lib.rs b/crates/bevy_ecs/macros/src/lib.rs index 61774882b8..0d4103d890 100644 --- a/crates/bevy_ecs/macros/src/lib.rs +++ b/crates/bevy_ecs/macros/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] extern crate proc_macro; diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index a4eba6880e..aa28a10df7 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -3,8 +3,13 @@ // TODO: remove once Edition 2024 is released #![allow(dependency_on_unit_never_type_fallback)] #![doc = include_str!("../README.md")] -// `rustdoc_internals` is needed for `#[doc(fake_variadics)]` -#![allow(internal_features)] +#![cfg_attr( + any(docsrs, docsrs_dep), + expect( + internal_features, + reason = "rustdoc_internals is needed for fake_variadic" + ) +)] #![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))] #![allow(unsafe_code)] #![doc( diff --git a/crates/bevy_encase_derive/src/lib.rs b/crates/bevy_encase_derive/src/lib.rs index 9d924bb9ff..0432d161f0 100644 --- a/crates/bevy_encase_derive/src/lib.rs +++ b/crates/bevy_encase_derive/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![forbid(unsafe_code)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![doc( diff --git a/crates/bevy_image/src/lib.rs b/crates/bevy_image/src/lib.rs index ce2e932826..2952bcec7c 100644 --- a/crates/bevy_image/src/lib.rs +++ b/crates/bevy_image/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![allow(unsafe_code)] pub mod prelude { diff --git a/crates/bevy_math/src/lib.rs b/crates/bevy_math/src/lib.rs index 1d99edd051..a276111c9d 100644 --- a/crates/bevy_math/src/lib.rs +++ b/crates/bevy_math/src/lib.rs @@ -1,5 +1,11 @@ #![forbid(unsafe_code)] -#![allow(internal_features)] +#![cfg_attr( + any(docsrs, docsrs_dep), + expect( + internal_features, + reason = "rustdoc_internals is needed for fake_variadic" + ) +)] #![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![doc( diff --git a/crates/bevy_mesh/src/lib.rs b/crates/bevy_mesh/src/lib.rs index 110a46b76f..83bc30df35 100644 --- a/crates/bevy_mesh/src/lib.rs +++ b/crates/bevy_mesh/src/lib.rs @@ -1,6 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] -#![allow(unsafe_code)] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] extern crate alloc; extern crate core; diff --git a/crates/bevy_mikktspace/tests/regression_test.rs b/crates/bevy_mikktspace/tests/regression_test.rs index 6ddee5e418..a0632b76e2 100644 --- a/crates/bevy_mikktspace/tests/regression_test.rs +++ b/crates/bevy_mikktspace/tests/regression_test.rs @@ -1,12 +1,8 @@ -#![allow( +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect( clippy::bool_assert_comparison, - clippy::explicit_iter_loop, - clippy::map_flatten, - clippy::match_same_arms, - clippy::redundant_else, clippy::semicolon_if_nothing_returned, - clippy::useless_conversion, - missing_docs + clippy::useless_conversion )] use bevy_mikktspace::{generate_tangents, Geometry}; diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 0f68411eba..ea3eab5285 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![deny(unsafe_code)] #![doc( diff --git a/crates/bevy_picking/src/backend.rs b/crates/bevy_picking/src/backend.rs index ff7baa9ce9..2e950fa804 100644 --- a/crates/bevy_picking/src/backend.rs +++ b/crates/bevy_picking/src/backend.rs @@ -84,8 +84,7 @@ pub struct PointerHits { } impl PointerHits { - // FIXME(15321): solve CI failures, then replace with `#[expect()]`. - #[allow(missing_docs, reason = "Not all docs are written yet (#3492).")] + #[expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] pub fn new(pointer: prelude::PointerId, picks: Vec<(Entity, HitData)>, order: f32) -> Self { Self { pointer, @@ -113,8 +112,7 @@ pub struct HitData { } impl HitData { - // FIXME(15321): solve CI failures, then replace with `#[expect()]`. - #[allow(missing_docs, reason = "Not all docs are written yet (#3492).")] + #[expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] pub fn new(camera: Entity, depth: f32, position: Option, normal: Option) -> Self { Self { camera, diff --git a/crates/bevy_reflect/src/lib.rs b/crates/bevy_reflect/src/lib.rs index 46253e13d1..c6e5ba0b45 100644 --- a/crates/bevy_reflect/src/lib.rs +++ b/crates/bevy_reflect/src/lib.rs @@ -1,7 +1,11 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] -// `rustdoc_internals` is needed for `#[doc(fake_variadics)]` -#![allow(internal_features)] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![cfg_attr( + any(docsrs, docsrs_dep), + expect( + internal_features, + reason = "rustdoc_internals is needed for fake_variadic" + ) +)] #![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", diff --git a/crates/bevy_render/macros/src/lib.rs b/crates/bevy_render/macros/src/lib.rs index 2d6d9a7864..5f88f589eb 100644 --- a/crates/bevy_render/macros/src/lib.rs +++ b/crates/bevy_render/macros/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] mod as_bind_group; diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index 2923afbad6..0acdd5ad50 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -1,8 +1,12 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] -#![allow(unsafe_code)] -// `rustdoc_internals` is needed for `#[doc(fake_variadics)]` -#![allow(internal_features)] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(unsafe_code)] +#![cfg_attr( + any(docsrs, docsrs_dep), + expect( + internal_features, + reason = "rustdoc_internals is needed for fake_variadic" + ) +)] #![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index 2d531e7859..40b987f2bf 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![forbid(unsafe_code)] #![doc( diff --git a/crates/bevy_state/macros/src/lib.rs b/crates/bevy_state/macros/src/lib.rs index 873d358ef5..f461f0ead2 100644 --- a/crates/bevy_state/macros/src/lib.rs +++ b/crates/bevy_state/macros/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] extern crate proc_macro; diff --git a/crates/bevy_state/src/lib.rs b/crates/bevy_state/src/lib.rs index bf6a1aab93..796516f5a6 100644 --- a/crates/bevy_state/src/lib.rs +++ b/crates/bevy_state/src/lib.rs @@ -27,8 +27,13 @@ //! - The [`in_state`](crate::condition::in_state) and [`state_changed`](crate::condition::state_changed) run conditions - which are used //! to determine whether a system should run based on the current state. -// `rustdoc_internals` is needed for `#[doc(fake_variadics)]` -#![allow(internal_features)] +#![cfg_attr( + any(docsrs, docsrs_dep), + expect( + internal_features, + reason = "rustdoc_internals is needed for fake_variadic" + ) +)] #![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))] #[cfg(feature = "bevy_app")] diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 3adb83fc37..842306fdf5 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -1,5 +1,4 @@ -// FIXME(15321): solve CI failures, then replace with `#![expect()]`. -#![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![doc( html_logo_url = "https://bevyengine.org/assets/icon.png", diff --git a/crates/bevy_window/src/event.rs b/crates/bevy_window/src/event.rs index e202b5fab5..4520a651ce 100644 --- a/crates/bevy_window/src/event.rs +++ b/crates/bevy_window/src/event.rs @@ -412,8 +412,7 @@ impl AppLifecycle { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -// FIXME(15321): solve CI failures, then replace with `#[expect()]`. -#[allow(missing_docs, reason = "Not all docs are written yet (#3492).")] +#[expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] pub enum WindowEvent { AppLifecycle(AppLifecycle), CursorEntered(CursorEntered), diff --git a/tests/how_to_test_systems.rs b/tests/how_to_test_systems.rs index ac4fc2f732..a2cb86a680 100644 --- a/tests/how_to_test_systems.rs +++ b/tests/how_to_test_systems.rs @@ -1,4 +1,4 @@ -#![allow(missing_docs)] +#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")] use bevy::prelude::*; #[derive(Component, Default)]