Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Fix clippy issues (#979)
Browse files Browse the repository at this point in the history
* Clippy

* Missing docs

* Broken doc links
  • Loading branch information
alice-i-cecile authored Jun 23, 2023
1 parent a5d06db commit dcd0fd6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
6 changes: 6 additions & 0 deletions emergence_lib/src/construction/terraform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,13 @@ impl TerraformingCommandsExt for Commands<'_, '_> {
}
}

/// A command to initialize a terraforming action.
struct TerraformCommand {
/// The hex where the terraforming action is taking place.
hex: Hex,
/// The terraforming action to perform.
action: TerraformingAction,
/// Is this a preview of the terraforming action?
preview: bool,
}

Expand Down Expand Up @@ -288,7 +292,9 @@ impl Command for TerraformCommand {
}
}

/// A command to cancel a terraforming action.
struct CancelTerraformCommand {
/// The hex where the terraforming action is taking place.
hex: Hex,
}

Expand Down
4 changes: 2 additions & 2 deletions emergence_lib/src/construction/zoning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ fn set_zoning(
Tool::Terraform(terraform_tool) => match apply_zoning {
true => {
for voxel_pos in relevant_tiles.iter() {
commands.start_terraform(voxel_pos.hex, terraform_tool.clone().into());
commands.start_terraform(voxel_pos.hex, (*terraform_tool).into());
}
}
false => {
for &voxel_pos in relevant_tiles.iter() {
commands.preview_terraform(voxel_pos.hex, terraform_tool.clone().into());
commands.preview_terraform(voxel_pos.hex, (*terraform_tool).into());
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/geometry/indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ impl MapGeometry {
assert!(
// The set of keys should be larger, because it accounts for all possible origins
// Units and signals must be able to *leave* any voxel
walkable_voxels.difference(&walkable_neighbors_keys).into_iter().count() == 0,
walkable_voxels.difference(&walkable_neighbors_keys).count() == 0,
"Walkable voxels and walkable neighbors keys have desynced. Found {:?} in walkable voxels but not in walkable neighbors keys.",
walkable_voxels.difference(&walkable_neighbors_keys)
);
Expand Down
4 changes: 1 addition & 3 deletions emergence_lib/src/player_interaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ pub(crate) enum PlayerAction {
/// If there is no structure there, the player's selection is cleared.
Copy,
/// Sets the zoning of all currently selected tiles to the currently selected structure.
///
/// If no structure is selected to build, zoning will be set to [`Zoning::None`](crate::construction::zoning::Zoning::None).
Paste,
/// Sets the zoning of all currently selected tiles to [`Zoning::None`](crate::construction::zoning::Zoning::None).
/// Cancels any planned actions (ghosts) selected.
ClearZoning,
/// Rotates the contents of the clipboard counterclockwise.
RotateClipboardLeft,
Expand Down
1 change: 1 addition & 0 deletions emergence_lib/src/player_interaction/picking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ fn update_raycast_with_cursor(
}
}

/// A marker that's used to identify meshes and sources for raycasting.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Reflect, FromReflect)]
pub(crate) struct PickableVoxel;

Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/structures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ mod tests {
/// beginning at the origin and moving right one.
///
/// This is a horizontal line, in the axial coordinate diagram shown here:
/// https://www.redblobgames.com/grids/hexagons/#coordinates
/// <https://www.redblobgames.com/grids/hexagons/#coordinates>
fn two_tile_footprint() -> Footprint {
let mut set = HashSet::new();
set.insert(VoxelPos::ZERO);
Expand Down

0 comments on commit dcd0fd6

Please sign in to comment.