Skip to content

Commit

Permalink
Fixed Clippy Lints
Browse files Browse the repository at this point in the history
  • Loading branch information
bushrat011899 committed Oct 24, 2023
1 parent df6c1cf commit bad1d07
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const DEFAULT_FPS: usize = 60;
pub struct GgrsSchedule;

/// Defines the Session that the GGRS Plugin should expect as a resource.
#[allow(clippy::large_enum_variant)]
#[derive(Resource)]
pub enum Session<T: Config> {
SyncTest(SyncTestSession<T>),
Expand Down Expand Up @@ -196,9 +197,9 @@ pub trait GgrsApp {

impl GgrsApp for App {
fn set_rollback_schedule_fps(&mut self, fps: usize) -> &mut Self {
let mut time_data = FixedTimestepData::default();
time_data.fps = fps;
self.world.insert_resource(time_data);
self.world
.insert_resource(FixedTimestepData { fps, ..default() });

self
}

Expand Down
2 changes: 1 addition & 1 deletion src/rollback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl EntityCommand for AddRollbackCommand {
world.entity_mut(id).insert(rollback);

world
.get_resource_or_insert_with::<RollbackOrdered>(|| default())
.get_resource_or_insert_with::<RollbackOrdered>(default)
.push(rollback);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/schedule_systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub(crate) fn handle_requests<T: Config>(requests: Vec<GGRSRequest<T>>, world: &
// look into resources and find the checksum
let checksum = world
.get_resource::<Checksum>()
.map(|&Checksum(checksum)| checksum as u128);
.map(|&Checksum(checksum)| checksum);

// we don't really use the buffer provided by GGRS
cell.save(frame, None, checksum);
Expand Down
5 changes: 3 additions & 2 deletions src/snapshot/component_checksum_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ where
C: Component + Hash,
{
/// A [`System`] responsible for managing a [`ChecksumPart`] for the [`Component`] type `C`.
#[allow(clippy::type_complexity)]
pub fn update(
mut commands: Commands,
rollback_ordered: Res<RollbackOrdered>,
components: Query<(&Rollback, &C), (With<Rollback>, Without<ChecksumFlag<C>>)>,
mut checksum: Query<&mut ChecksumPart, (Without<Rollback>, With<ChecksumFlag<C>>)>,
) {
let mut hasher = bevy::utils::FixedState::default().build_hasher();
let mut hasher = bevy::utils::FixedState.build_hasher();

let mut result = 0;

Expand All @@ -50,7 +51,7 @@ where
component.hash(&mut hasher);

// XOR chosen over addition or multiplication as it is closed on u64 and commutative
result = result ^ hasher.finish();
result ^= hasher.finish();
}

// Hash the XOR'ed result to break commutativity with other types
Expand Down
2 changes: 1 addition & 1 deletion src/snapshot/resource_checksum_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ where
resource: Res<R>,
mut checksum: Query<&mut ChecksumPart, (Without<Rollback>, With<ChecksumFlag<R>>)>,
) {
let mut hasher = bevy::utils::FixedState::default().build_hasher();
let mut hasher = bevy::utils::FixedState.build_hasher();

resource.hash(&mut hasher);

Expand Down

0 comments on commit bad1d07

Please sign in to comment.