Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sn-blg committed Jul 9, 2024
1 parent 3ea30a8 commit 3605a89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 1 addition & 7 deletions src/h3m/obstacle_generator/obstacle_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,7 @@ impl ObstacleMap {
true
};

for &index in area.indexes().iter().rev() {
if is_valid_index(index) {
return Some(index);
}
}

None
area.indexes().iter().rev().find(|&&index| is_valid_index(index)).copied()
}

pub fn add_obstacle(
Expand Down
6 changes: 2 additions & 4 deletions src/h3m/terrain_map/draft_terrain_map/tile_generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ fn is_terrain_relation_matched(
let terrain = cell.surface.terrain;
let neighbour_terrain = neighbour
.tile
.map(|t| match t.terrain_visible_type() {
.and_then(|t| match t.terrain_visible_type() {
TerrainVisibleType::Diff(terrain_visible_type) => Some(terrain_visible_type),
_ => None,
})
.flatten()
.unwrap_or(neighbour.surface.terrain);
match relation {
TerrainRelation::Same | TerrainRelation::Eq => neighbour_terrain == terrain,
Expand Down Expand Up @@ -229,7 +228,7 @@ impl TileGenerator {
[vertical_neighbour_indexes, horizontal_neighbour_indexes]
.concat()
.into_iter()
.map(|neighbour_index| {
.filter_map(|neighbour_index| {
Some((
get_neighbour_tile(
&neighborhood[neighbour_index],
Expand All @@ -238,7 +237,6 @@ impl TileGenerator {
neighbour_index,
))
})
.flatten()
{
if (neighbour_tile.horizontal_mirroring() == horizontal_mirroring)
&& (neighbour_tile.vertical_mirroring() == vertical_mirroring)
Expand Down

0 comments on commit 3605a89

Please sign in to comment.