Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
hakolao committed Sep 27, 2024
1 parent 7c3e15e commit 9af92d2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ glam = "0.29"
[lints.clippy]
blocks_in_conditions = "allow"
field_reassign_with_default = "allow"
self_named_constructors = "allow"

[profile.dev]
opt-level = 3
Expand Down
6 changes: 3 additions & 3 deletions examples/sand/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl Grid {
let curr = self.data[curr_index];
let curr_sand = curr.sand;
// Below
if !curr_sand.is_empty() && y as i32 - 1 >= 0 {
if !curr_sand.is_empty() && y as i32 > 0 {
let below_index = self.index(x as i32, y as i32 - 1);
let below_sand = self.data[below_index].sand;
let below = self.data[below_index];
Expand All @@ -106,7 +106,7 @@ impl Grid {
} else {
let p = rand::random::<f32>();
let mut is_swap = false;
if p > 0.5 && x as i32 - 1 >= 0 {
if p > 0.5 && x as i32 > 0 {
let left_diag_index = self.index(x as i32 - 1, y as i32 - 1);
let left_diag_sand = self.data[left_diag_index].sand;
let left = self.data[left_diag_index];
Expand All @@ -131,7 +131,7 @@ impl Grid {
}
if !is_swap && curr_sand.is_water() {
let p = rand::random::<f32>();
if p > 0.5 && x as i32 - 1 >= 0 {
if p > 0.5 && x as i32 > 0 {
let left_index = self.index(x as i32 - 1, y as i32);
let left_sand = self.data[left_index].sand;
let left = self.data[left_index];
Expand Down
2 changes: 1 addition & 1 deletion src/device_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl DeviceContext {
None => return Err(GlassError::AdapterError),
};

let path = config.trace_path.as_ref().map(|p| p.as_path());
let path = config.trace_path.as_deref();
// Create the logical device and command queue
let (device, queue) = match wait_async(adapter.request_device(
&DeviceDescriptor {
Expand Down
2 changes: 1 addition & 1 deletion src/glass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Glass {
};
event_loop
.run_app(&mut glass)
.map_err(|e| GlassError::EventLoopError(e))
.map_err(GlassError::EventLoopError)
}
}

Expand Down

0 comments on commit 9af92d2

Please sign in to comment.