Add clippy, fix up warnings
CI / cargo fmt (push) Successful in 23s
CI / cargo test (push) Successful in 12m44s
CI / cargo test (GPU) (push) Successful in 16m32s

This commit is contained in:
2026-07-12 14:45:46 -04:00
parent 08ada94bd2
commit 9ea4261a84
7 changed files with 19 additions and 19 deletions
+4 -1
View File
@@ -21,7 +21,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- run: cargo check --all-targets - run: cargo check --all-targets
- run: cargo clippy --all-targets
- run: cargo test - run: cargo test
test-gpu: test-gpu:
@@ -30,5 +33,5 @@ jobs:
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo install --git https://github.com/rust-gpu/rust-gpu cargo-gpu - run: cargo install --git https://github.com/rust-gpu/rust-gpu cargo-gpu --rev 67f1ff2
- run: cargo gpu check --auto-install-rust-toolchain -p enkou-shaders - run: cargo gpu check --auto-install-rust-toolchain -p enkou-shaders
+3 -6
View File
@@ -19,15 +19,12 @@ mod test {
} }
fn has_entry_point(execution_model: ExecutionModel, name: &str) -> bool { fn has_entry_point(execution_model: ExecutionModel, name: &str) -> bool {
for ref entry_point in shader().entry_points.iter() { for entry_point in shader().entry_points.iter() {
let operands: Vec<Operand> = entry_point let operands: Vec<Operand> = entry_point
.operands .operands
.iter() .iter()
.filter(|op| match op { .filter(|op| matches!(op, Operand::ExecutionModel(_) | Operand::LiteralString(_)))
Operand::ExecutionModel(_) | Operand::LiteralString(_) => true, .cloned()
_ => false,
})
.map(|op| op.clone())
.collect(); .collect();
assert_eq!(operands.len(), 2); assert_eq!(operands.len(), 2);
+3 -4
View File
@@ -78,10 +78,9 @@ pub fn main() -> Result<()> {
image.save(temp.path()).context("Unable to save image")?; image.save(temp.path()).context("Unable to save image")?;
let open_program: &str = cfg_select! { let open_program: &str = cfg_select! {
unix => Some("xdg-open"), unix => "xdg-open",
_ => None, _ => panic!("No available program to open images")
} };
.expect("No available program to open images");
Command::new(open_program) Command::new(open_program)
.arg(temp.path()) .arg(temp.path())
+2 -1
View File
@@ -1,6 +1,7 @@
//! # Enkou //! # Enkou
#![no_std] #![no_std]
#![warn(missing_docs)] #![deny(missing_docs)]
#![allow(clippy::needless_range_loop)] // SPIR-V backend has issues with iteration over items
pub mod camera; pub mod camera;
pub mod chaos_game; pub mod chaos_game;
+1 -1
View File
@@ -24,7 +24,7 @@ pub(crate) fn xoshiro256starstar_from_seed(
// - `u64::from_le_bytes` has issues with `OpBitcast` in SPIR-V validation // - `u64::from_le_bytes` has issues with `OpBitcast` in SPIR-V validation
for i in 0..rng_state_actual.len() { for i in 0..rng_state_actual.len() {
for j in 0..size_of::<u64>() { for j in 0..size_of::<u64>() {
rng_state_actual[i] |= (rng_state[i * size_of::<u64>() + j] as u64) << j * 8; rng_state_actual[i] |= (rng_state[i * size_of::<u64>() + j] as u64) << (j * 8);
} }
} }
+1 -1
View File
@@ -41,7 +41,7 @@ impl Transform {
let variation_start = self.variation_range.x; let variation_start = self.variation_range.x;
let variation_end = self.variation_range.y; let variation_end = self.variation_range.y;
for variation_index in variation_start..variation_end { for variation_index in variation_start..variation_end {
let ref variation = variations[variation_index as usize]; let variation = &variations[variation_index as usize];
point_output += variation.transform_point(point, rng, &self.coefficients) point_output += variation.transform_point(point, rng, &self.coefficients)
} }