Skip to content

Commit 0244a84

Browse files
authored
Fix lint errors on bevy_ecs with disabled features (#18488)
# Objective - `bevy_ecs` has lint errors without some features ## Solution - Fix `clippy::allow-attributes-without-reason` when `bevy_reflect` is disabled by adding a reason - Fix `clippy::needless_return` when `std` is disabled by adding a gated `expect` attribute and a comment to remove it when the `no_std` stuff is addressed ## Testing - `cargo clippy -p bevy_ecs --no-default-features --no-deps -- --D warnings` - CI
1 parent d02a206 commit 0244a84

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

crates/bevy_ecs/src/entity/clone_entities.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub struct ComponentCloneCtx<'a, 'b> {
8484
#[cfg(feature = "bevy_reflect")]
8585
type_registry: Option<&'a crate::reflect::AppTypeRegistry>,
8686
#[cfg(not(feature = "bevy_reflect"))]
87-
#[expect(dead_code)]
87+
#[expect(dead_code, reason = "type_registry is only used with bevy_reflect")]
8888
type_registry: Option<&'a ()>,
8989
}
9090

crates/bevy_ecs/src/storage/resource.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ impl<const SEND: bool> ResourceData<SEND> {
6767
#[inline]
6868
fn validate_access(&self) {
6969
if SEND {
70+
#[cfg_attr(
71+
not(feature = "std"),
72+
expect(
73+
clippy::needless_return,
74+
reason = "needless until no_std is addressed (see below)",
75+
)
76+
)]
7077
return;
7178
}
7279

@@ -84,6 +91,7 @@ impl<const SEND: bool> ResourceData<SEND> {
8491
// TODO: Handle no_std non-send.
8592
// Currently, no_std is single-threaded only, so this is safe to ignore.
8693
// To support no_std multithreading, an alternative will be required.
94+
// Remove the #[expect] attribute above when this is addressed.
8795
}
8896

8997
/// Returns true if the resource is populated.

0 commit comments

Comments
 (0)