Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ allow_attributes = "warn"
allow_attributes_without_reason = "warn"

[workspace.lints.rust]
# Strictly temporary until encase fixes dead code generation from ShaderType macros
dead_code = "allow"
missing_docs = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }
unsafe_code = "deny"
Expand Down Expand Up @@ -120,8 +118,6 @@ allow_attributes = "warn"
allow_attributes_without_reason = "warn"

[lints.rust]
# Strictly temporary until encase fixes dead code generation from ShaderType macros
dead_code = "allow"
missing_docs = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }
unsafe_code = "deny"
Expand Down
8 changes: 8 additions & 0 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1684,9 +1684,17 @@ mod tests {
b: u32,
}

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such is intentionally never constructed."
)]
#[derive(AppLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
struct EmptyTupleLabel();

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such is intentionally never constructed."
)]
#[derive(AppLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
struct EmptyStructLabel {}

Expand Down
8 changes: 8 additions & 0 deletions crates/bevy_asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,10 @@ mod tests {
Empty,
}

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such is intentionally never constructed."
)]
#[derive(Asset, TypePath)]
pub struct StructTestAsset {
#[dependency]
Expand All @@ -1890,6 +1894,10 @@ mod tests {
embedded: TestAsset,
}

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such is intentionally never constructed."
)]
#[derive(Asset, TypePath)]
pub struct TupleTestAsset(#[dependency] Handle<TestAsset>);

Expand Down
36 changes: 32 additions & 4 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1946,15 +1946,27 @@ mod tests {
#[derive(Bundle)]
struct Simple(ComponentA);

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such is intentionally never constructed."
)]
#[derive(Bundle)]
struct Tuple(Simple, ComponentB);

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such is intentionally never constructed."
)]
#[derive(Bundle)]
struct Record {
field0: Simple,
field1: ComponentB,
}

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such is intentionally never constructed."
)]
#[derive(Component)]
struct MyEntities {
#[entities]
Expand All @@ -1963,10 +1975,6 @@ mod tests {
another_one: Entity,
#[entities]
maybe_entity: Option<Entity>,
#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such this field is intentionally never used."
)]
something_else: String,
}

Expand All @@ -1981,22 +1989,42 @@ mod tests {
fn clone_entities() {
use crate::entity::{ComponentCloneCtx, SourceComponent};

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such this field is intentionally never used."
)]
#[derive(Component)]
#[component(clone_behavior = Ignore)]
struct IgnoreClone;

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such this field is intentionally never used."
)]
#[derive(Component)]
#[component(clone_behavior = Default)]
struct DefaultClone;

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such this field is intentionally never used."
)]
#[derive(Component)]
#[component(clone_behavior = Custom(custom_clone))]
struct CustomClone;

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such this field is intentionally never used."
)]
#[derive(Component, Clone)]
#[component(clone_behavior = clone::<Self>())]
struct CloneFunction;

#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such this field is intentionally never used."
)]
fn custom_clone(_source: &SourceComponent, _ctx: &mut ComponentCloneCtx) {}
}

Expand Down
16 changes: 16 additions & 0 deletions crates/bevy_ecs/src/schedule/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,17 @@ mod tests {
b: u32,
}

#[expect(
dead_code,
reason = "This is a derive macro compilation test. It won't be constructed."
)]
#[derive(ScheduleLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
struct EmptyTupleLabel();

#[expect(
dead_code,
reason = "This is a derive macro compilation test. It won't be constructed."
)]
#[derive(ScheduleLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
struct EmptyStructLabel {}

Expand Down Expand Up @@ -473,9 +481,17 @@ mod tests {
b: u32,
}

#[expect(
dead_code,
reason = "This is a derive macro compilation test. It won't be constructed."
)]
#[derive(SystemSet, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
struct EmptyTupleSet();

#[expect(
dead_code,
reason = "This is a derive macro compilation test. It won't be constructed."
)]
#[derive(SystemSet, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
struct EmptyStructSet {}

Expand Down
3 changes: 0 additions & 3 deletions crates/bevy_ecs/src/world/entity_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6312,9 +6312,6 @@ mod tests {
#[derive(Component, Clone, PartialEq, Debug)]
struct C(u32);

#[derive(Component, Clone, PartialEq, Debug, Default)]
struct D;

let mut world = World::new();
let entity_a = world.spawn((A, B, C(5))).id();
let entity_b = world.spawn((A, C(4))).id();
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_render/src/render_resource/bind_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,10 @@ mod test {

#[test]
fn texture_visibility() {
#[expect(
dead_code,
reason = "This is a derive macro compilation test. It will not be constructed."
)]
#[derive(AsBindGroup)]
pub struct TextureVisibilityTest {
#[texture(0, visibility(all))]
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_render/src/renderer/raw_vulkan_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ pub(crate) async fn create_raw_device(

#[derive(Error, Debug)]
pub(crate) enum CreateRawVulkanDeviceError {
#[error("Could not create a raw Vulkan device because the Vulkan backend is not supported")]
UnsupportedBackend,
#[error(transparent)]
RequestDeviceError(#[from] wgpu::RequestDeviceError),
#[error(transparent)]
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ mod tests {
enum TestState {
#[default]
A,
#[expect(
dead_code,
reason = "This struct is used as a compilation test to test the derive macros, and as such is intentionally never constructed."
)]
B,
}

Expand Down
3 changes: 0 additions & 3 deletions examples/ui/drag_to_scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
use bevy::color::palettes::css::RED;
use bevy::prelude::*;

#[derive(Component)]
struct DragNode;

#[derive(Component)]
struct ScrollableNode;

Expand Down
Loading