Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Fixing clippy suggestions and tests after the 0.13 update. Test faile…
Browse files Browse the repository at this point in the history
…d due to larger size of the TileKind enum due to Entity aligment changes.
  • Loading branch information
porkbrain committed Feb 21, 2024
1 parent c81c1a7 commit 4a0cc43
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bevy_magic_light_2d/src/gi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl<T: LightScene> render_graph::Node for LightPass2DNode<T> {

let mut pass = render_context.command_encoder().begin_compute_pass(
&ComputePassDescriptor {
label: Some(&T::light_pass().0),
label: Some(T::light_pass().0),
..default()
},
);
Expand Down
1 change: 1 addition & 0 deletions common/physics/src/poissons_equation/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub(crate) fn spawn_visualization<
default(),
false,
default(),
default(),
)
.expect("Cannot load vector arrow image"),
);
Expand Down
4 changes: 1 addition & 3 deletions common/top_down/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,7 @@ impl CharacterBundleBuilder {

// for the time being, player is always winnie, so let's squash any bugs
// during development until this needs to change
debug_assert!(
!is_player || (is_player && character == Character::Winnie)
);
debug_assert!(!is_player || character == Character::Winnie);

let step_time = step_time.unwrap_or(character.default_step_time());

Expand Down
9 changes: 6 additions & 3 deletions common/top_down/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ pub enum TileKind<L> {
/// Getting rid of 4 bytes per tile would mean we'd fetch 12 less bytes on
/// each square access.
/// The entity array access should be cheap.
/// UPDATE: With bevy 0.13 the entity alignment has been changed,
/// storing entity in an enum is more expensive than before.
Actor(Entity),
/// Specific for a given map.
Local(L),
Expand Down Expand Up @@ -991,13 +993,14 @@ mod tests {
assert_eq!(tilemap.set_tile_kind(sq(100, 0), 0, TileKind::Wall), None);
}

/// Useful to track to prevent regressions.
#[test]
fn it_has_small_size_of_tilekind() {
assert_eq!(std::mem::size_of::<TileKind<TestTileKind>>(), 12);
fn it_has_const_size_of_tilekind() {
assert_eq!(std::mem::size_of::<TileKind<TestTileKind>>(), 16);

let square: SmallVec<[TileKind<TestTileKind>; 3]> =
smallvec![default(), default(), default(), default(), default()];
assert_eq!(std::mem::size_of_val(&square), 48);
assert_eq!(std::mem::size_of_val(&square), 56);
}

#[derive(Default, Reflect)]
Expand Down
2 changes: 1 addition & 1 deletion common/visuals/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{

/// Advances the animation by one frame.
/// This requires that the [`AtlasAnimationTimer`] component is present along
/// with [`TextureAtlasSprite`] and [`AtlasAnimation`].
/// with [`TextureAtlas`] and [`AtlasAnimation`].
pub fn advance_atlas_animation(
mut cmd: Commands,
time: Res<Time>,
Expand Down
2 changes: 1 addition & 1 deletion common/visuals/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl BeginInterpolationEvent {

/// What should be interpolated?
pub enum InterpolationOf {
/// Interpolate the color of [`TextureAtlasSprite`] and [`Sprite`].
/// Interpolate the color of [`TextureAtlas`] and [`Sprite`].
Color {
/// The color to interpolate from.
/// If not provided, the latest color is used.
Expand Down

0 comments on commit 4a0cc43

Please sign in to comment.