Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy fixes #436

Merged
merged 3 commits into from
Jun 11, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --no-deps -- -D warnings
args: --no-deps --examples -- -D warnings

22 changes: 10 additions & 12 deletions examples/hex_neighbors_radius_chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ fn update_radius(mut radius: ResMut<HighlightRadius>, keyboard_input: Res<Input<
#[derive(Component)]
struct NeighborHighlight;

#[allow(clippy::too_many_arguments)]
// Highlight neighbors of a tile in a radius
fn highlight_neighbor_labels(
mut commands: Commands,
Expand Down Expand Up @@ -503,19 +504,16 @@ fn highlight_neighbor_labels(

if let Some(neighbors) = neighbors {
for (map_type, grid_size, tile_storage, map_t) in tilemap_query.iter() {
for opt_tile_entity in tile_storage.iter() {
if let Some(tile_entity) = opt_tile_entity {
if let Ok(tile_pos) = tiles_q.get(*tile_entity) {
let tile_hex_pos =
hex_pos_from_tile_pos(tile_pos, grid_size, map_type, map_t);
if neighbors.contains(&tile_hex_pos) {
if let Ok(label) = tile_label_q.get(*tile_entity) {
if let Ok(mut tile_text) = text_q.get_mut(label.0) {
for mut section in tile_text.sections.iter_mut() {
section.style.color = Color::BLUE;
}
commands.entity(*tile_entity).insert(NeighborHighlight);
for tile_entity in tile_storage.iter().flatten() {
if let Ok(tile_pos) = tiles_q.get(*tile_entity) {
let tile_hex_pos = hex_pos_from_tile_pos(tile_pos, grid_size, map_type, map_t);
if neighbors.contains(&tile_hex_pos) {
if let Ok(label) = tile_label_q.get(*tile_entity) {
if let Ok(mut tile_text) = text_q.get_mut(label.0) {
for mut section in tile_text.sections.iter_mut() {
section.style.color = Color::BLUE;
}
commands.entity(*tile_entity).insert(NeighborHighlight);
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,9 @@ pub struct TilemapBundle {
pub mod prelude {
#[cfg(all(not(feature = "atlas"), feature = "render"))]
pub use crate::array_texture_preload::*;
pub use crate::helpers;
pub use crate::helpers::filling::*;
pub use crate::helpers::geometry::*;
pub use crate::helpers::hex_grid::*;
pub use crate::helpers::projection::*;
pub use crate::helpers::selection::*;
pub use crate::helpers::square_grid::*;
pub use crate::helpers::transform::*;
pub use crate::map::*;
pub use crate::tiles::*;
Expand Down
2 changes: 1 addition & 1 deletion src/render/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use bevy::{
utils::HashMap,
};

use crate::prelude::{chunk_aabb, chunk_index_to_world_space};
use crate::prelude::helpers::transform::{chunk_aabb, chunk_index_to_world_space};
use crate::render::extract::ExtractedFrustum;
use crate::{
map::{TilemapSize, TilemapTexture, TilemapType},
Expand Down