Skip to content

Commit 7cc6c5f

Browse files
authored
Merge pull request #104 from nathanaelneveux/fix-rust-1-95-clippy
minimal changes for clippy
2 parents 0c2a77a + 5593bb8 commit 7cc6c5f

6 files changed

Lines changed: 7 additions & 13 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ path = "examples/noise_terrain.rs"
2828
[[example]]
2929
name = "noise_terrain_lod"
3030
path = "examples/noise_terrain_lod.rs"
31-
required-features = ["noise"]
3231

3332
[[example]]
3433
name = "custom_meshing"

examples/custom_meshing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl VoxelWorldConfig for MainWorld {
9797
let mut tex_coords = Vec::with_capacity(num_vertices);
9898
let mut material_types = Vec::with_capacity(num_vertices);
9999

100-
for (group, face) in buffer.quads.groups.into_iter().zip(faces.into_iter()) {
100+
for (group, face) in buffer.quads.groups.into_iter().zip(faces) {
101101
for quad in group.into_iter() {
102102
let _normal = IVec3::from([
103103
face.signed_normal().x,

examples/multiple_noise_terrain.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ fn setup(mut commands: Commands) {
9090
});
9191
}
9292

93+
#[allow(clippy::type_complexity)]
9394
fn get_voxel_fn() -> Box<
9495
dyn FnMut(IVec3, Option<WorldVoxel<BlockTexture>>) -> WorldVoxel<BlockTexture>
9596
+ Send

examples/noise_terrain_lod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ fn setup(mut commands: Commands, mut fonts: ResMut<Assets<Font>>) {
202202
));
203203

204204
// Ambient light, same color as sun
205-
commands.insert_resource(AmbientLight {
205+
commands.insert_resource(GlobalAmbientLight {
206206
color: Color::srgb(0.98, 0.95, 0.82),
207207
brightness: 100.0,
208208
affects_lightmapped_meshes: true,

src/meshing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn mesh_from_quads_for_shape<I: PartialEq + Copy>(
114114

115115
let voxel_size = voxel_size_from_shape(shape);
116116

117-
for (group, face) in quads.groups.into_iter().zip(faces.into_iter()) {
117+
for (group, face) in quads.groups.into_iter().zip(faces) {
118118
for quad in group.into_iter() {
119119
let quad = Into::<block_mesh::geometry::UnorientedQuad>::into(quad);
120120
let normal = IVec3::from([

src/voxel_world_internal.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,17 +411,13 @@ where
411411
) {
412412
let thread_pool = AsyncComputeTaskPool::get();
413413
let max_threads = configuration.max_active_chunk_threads();
414-
let mut active_threads = chunk_threads.iter().count();
414+
let remaining_threads = max_threads.saturating_sub(chunk_threads.iter().count());
415415

416-
if max_threads == 0 {
416+
if remaining_threads == 0 {
417417
return;
418418
}
419419

420-
for chunk in dirty_chunks.iter() {
421-
if active_threads >= max_threads {
422-
break;
423-
}
424-
420+
for chunk in dirty_chunks.iter().take(remaining_threads) {
425421
let previous_chunk_data = {
426422
let read_lock = chunk_map.get_read_lock();
427423
ChunkMap::<C, C::MaterialIndex>::get(&chunk.position, &read_lock)
@@ -492,8 +488,6 @@ where
492488
))
493489
.remove::<NeedsRemesh>();
494490

495-
active_threads += 1;
496-
497491
ev_chunk_will_remesh
498492
.write(ChunkWillRemesh::<C>::new(chunk.position, chunk.entity));
499493
}

0 commit comments

Comments
 (0)