From da92e5c2837b27433286cf0dd9d887fd44dda254 Mon Sep 17 00:00:00 2001 From: Sébastien Crozet Date: Sat, 27 Jan 2024 16:49:53 +0100 Subject: Fix clippy and enable clippy on CI --- benchmarks3d/all_benchmarks3.rs | 4 ++-- benchmarks3d/keva3.rs | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'benchmarks3d') diff --git a/benchmarks3d/all_benchmarks3.rs b/benchmarks3d/all_benchmarks3.rs index bca730b..591886e 100644 --- a/benchmarks3d/all_benchmarks3.rs +++ b/benchmarks3d/all_benchmarks3.rs @@ -36,7 +36,7 @@ fn parse_command_line() -> Command { while let Some(arg) = args.next() { if &arg[..] == "--example" { - return Command::Run(args.next().unwrap_or(String::new())); + return Command::Run(args.next().unwrap_or_default()); } else if &arg[..] == "--list" { return Command::List; } @@ -68,7 +68,7 @@ pub fn main() { ]; // Lexicographic sort, with stress tests moved at the end of the list. - builders.sort_by(|a, b| match (a.0.starts_with("("), b.0.starts_with("(")) { + builders.sort_by(|a, b| match (a.0.starts_with('('), b.0.starts_with('(')) { (true, true) | (false, false) => a.0.cmp(b.0), (true, false) => Ordering::Greater, (false, true) => Ordering::Less, diff --git a/benchmarks3d/keva3.rs b/benchmarks3d/keva3.rs index ecd6e77..4f5cd54 100644 --- a/benchmarks3d/keva3.rs +++ b/benchmarks3d/keva3.rs @@ -7,9 +7,7 @@ pub fn build_block( colliders: &mut ColliderSet, half_extents: Vector, shift: Vector, - mut numx: usize, - numy: usize, - mut numz: usize, + (mut numx, numy, mut numz): (usize, usize, usize), ) { let dimensions = [half_extents.xyz(), half_extents.zyx()]; let block_width = 2.0 * half_extents.z * numx as f32; @@ -56,8 +54,8 @@ pub fn build_block( // Close the top. let dim = half_extents.zxy(); - for i in 0..(block_width / (dim.x as f32 * 2.0)) as usize { - for j in 0..(block_width / (dim.z as f32 * 2.0)) as usize { + for i in 0..(block_width / (dim.x * 2.0)) as usize { + for j in 0..(block_width / (dim.z * 2.0)) as usize { // Build the rigid body. let rigid_body = RigidBodyBuilder::dynamic().translation(vector![ i as f32 * dim.x * 2.0 + dim.x + shift.x, @@ -114,9 +112,7 @@ pub fn init_world(testbed: &mut Testbed) { &mut colliders, half_extents, vector![-block_width / 2.0, block_height, -block_width / 2.0], - numx, - numy, - numz, + (numx, numy, numz), ); block_height += numy as f32 * half_extents.y * 2.0 + half_extents.x * 2.0; num_blocks_built += numx * numy * numz; -- cgit