aboutsummaryrefslogtreecommitdiff
path: root/benchmarks3d
diff options
context:
space:
mode:
authorSébastien Crozet <sebcrozet@dimforge.com>2024-01-27 16:49:53 +0100
committerSébastien Crozet <sebastien@crozet.re>2024-01-27 17:13:08 +0100
commitda92e5c2837b27433286cf0dd9d887fd44dda254 (patch)
tree00428ce290288f5c64e53dee13d88ffdde4df0ca /benchmarks3d
parentaef873f20e7a1ee66b9d4c066884fa794048587b (diff)
downloadrapier-da92e5c2837b27433286cf0dd9d887fd44dda254.tar.gz
rapier-da92e5c2837b27433286cf0dd9d887fd44dda254.tar.bz2
rapier-da92e5c2837b27433286cf0dd9d887fd44dda254.zip
Fix clippy and enable clippy on CI
Diffstat (limited to 'benchmarks3d')
-rw-r--r--benchmarks3d/all_benchmarks3.rs4
-rw-r--r--benchmarks3d/keva3.rs12
2 files changed, 6 insertions, 10 deletions
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<f32>,
shift: Vector<f32>,
- 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;