Skip to content

Commit

Permalink
Fix Ci failing over dead code in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Brezak committed Mar 21, 2024
1 parent 7b842e3 commit f55bcbf
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions crates/bevy_asset/src/server/loaders.rs
Expand Up @@ -307,12 +307,16 @@ mod tests {

use super::*;

// The compiler notices these fields are never read and raises a dead_code lint which kill CI.
#[allow(dead_code)]
#[derive(Asset, TypePath, Debug)]
struct A(usize);

#[allow(dead_code)]
#[derive(Asset, TypePath, Debug)]
struct B(usize);

#[allow(dead_code)]
#[derive(Asset, TypePath, Debug)]
struct C(usize);

Expand Down
6 changes: 6 additions & 0 deletions crates/bevy_ecs/src/lib.rs
Expand Up @@ -84,6 +84,7 @@ mod tests {
#[derive(Component, Debug, PartialEq, Eq, Clone, Copy)]
struct C;

#[allow(dead_code)]
#[derive(Default)]
struct NonSendA(usize, PhantomData<*mut ()>);

Expand All @@ -102,6 +103,8 @@ mod tests {
}
}

// TODO: The compiler says the Debug and Clone are removed during dead code analysis. Investigate.
#[allow(dead_code)]
#[derive(Component, Clone, Debug)]
#[component(storage = "SparseSet")]
struct DropCkSparse(DropCk);
Expand Down Expand Up @@ -1724,9 +1727,12 @@ mod tests {
);
}

// These fields are never read so we get a dead code lint here.
#[allow(dead_code)]
#[derive(Component)]
struct ComponentA(u32);

#[allow(dead_code)]
#[derive(Component)]
struct ComponentB(u32);

Expand Down
1 change: 1 addition & 0 deletions crates/bevy_ecs/src/system/commands/mod.rs
Expand Up @@ -1092,6 +1092,7 @@ mod tests {
Arc,
};

#[allow(dead_code)]
#[derive(Component)]
#[component(storage = "SparseSet")]
struct SparseDropCk(DropCk);
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_ecs/src/system/mod.rs
Expand Up @@ -844,7 +844,9 @@ mod tests {
let mut world = World::default();

world.insert_resource(SystemRan::No);
#[allow(dead_code)]
struct NotSend1(std::rc::Rc<i32>);
#[allow(dead_code)]
struct NotSend2(std::rc::Rc<i32>);
world.insert_non_send_resource(NotSend1(std::rc::Rc::new(0)));

Expand All @@ -867,7 +869,9 @@ mod tests {
let mut world = World::default();

world.insert_resource(SystemRan::No);
#[allow(dead_code)]
struct NotSend1(std::rc::Rc<i32>);
#[allow(dead_code)]
struct NotSend2(std::rc::Rc<i32>);

world.insert_non_send_resource(NotSend1(std::rc::Rc::new(1)));
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_ecs/src/system/system_param.rs
Expand Up @@ -1578,6 +1578,7 @@ mod tests {
// Compile test for https://github.com/bevyengine/bevy/pull/7001.
#[test]
fn system_param_const_generics() {
#[allow(dead_code)]
#[derive(SystemParam)]
pub struct ConstGenericParam<'w, const I: usize>(Res<'w, R<I>>);

Expand Down Expand Up @@ -1635,6 +1636,7 @@ mod tests {
#[derive(SystemParam)]
pub struct UnitParam;

#[allow(dead_code)]
#[derive(SystemParam)]
pub struct TupleParam<'w, 's, R: Resource, L: FromWorld + Send + 'static>(
Res<'w, R>,
Expand All @@ -1651,6 +1653,7 @@ mod tests {
#[derive(Resource)]
struct PrivateResource;

#[allow(dead_code)]
#[derive(SystemParam)]
pub struct EncapsulatedParam<'w>(Res<'w, PrivateResource>);

Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_ecs/src/world/command_queue.rs
Expand Up @@ -344,6 +344,7 @@ mod test {
// This has an arbitrary value `String` stored to ensure
// when then command gets pushed, the `bytes` vector gets
// some data added to it.
#[allow(dead_code)]
struct PanicCommand(String);
impl Command for PanicCommand {
fn apply(self, _: &mut World) {
Expand Down Expand Up @@ -392,6 +393,7 @@ mod test {
assert_is_send(SpawnCommand);
}

#[allow(dead_code)]
struct CommandWithPadding(u8, u16);
impl Command for CommandWithPadding {
fn apply(self, _: &mut World) {}
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_hierarchy/src/child_builder.rs
Expand Up @@ -851,6 +851,7 @@ mod tests {
);
}

#[allow(dead_code)]
#[derive(Component)]
struct C(u32);

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_winit/src/winit_windows.rs
Expand Up @@ -107,7 +107,7 @@ impl WinitWindows {
#[cfg(target_os = "windows")]
{
use winit::platform::windows::WindowBuilderExtWindows;
winit_window_builder = winit_window_builder.with_skip_taskbar(window.skip_taskbar)
winit_window_builder = winit_window_builder.with_skip_taskbar(window.skip_taskbar);
}

#[cfg(any(
Expand Down

0 comments on commit f55bcbf

Please sign in to comment.