Fix clippy and enable clippy on CI
This commit is contained in:
committed by
Sébastien Crozet
parent
aef873f20e
commit
da92e5c283
@@ -86,8 +86,8 @@ fn demo_name_from_url() -> Option<String> {
|
||||
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))]
|
||||
pub fn main() {
|
||||
let demo = demo_name_from_command_line()
|
||||
.or_else(|| demo_name_from_url())
|
||||
.unwrap_or(String::new())
|
||||
.or_else(demo_name_from_url)
|
||||
.unwrap_or_default()
|
||||
.to_camel_case();
|
||||
|
||||
let mut builders: Vec<(_, fn(&mut Testbed))> = vec![
|
||||
@@ -157,7 +157,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,
|
||||
|
||||
@@ -27,9 +27,9 @@ fn create_wall(
|
||||
colliders.insert_with_parent(collider, handle, bodies);
|
||||
k += 1;
|
||||
if k % 2 == 0 {
|
||||
testbed.set_initial_body_color(handle, [255. / 255., 131. / 255., 244.0 / 255.]);
|
||||
testbed.set_initial_body_color(handle, [1., 131. / 255., 244.0 / 255.]);
|
||||
} else {
|
||||
testbed.set_initial_body_color(handle, [131. / 255., 255. / 255., 244.0 / 255.]);
|
||||
testbed.set_initial_body_color(handle, [131. / 255., 1., 244.0 / 255.]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ fn create_actuated_revolute_joints(
|
||||
} else if i == num - 1 {
|
||||
let stiffness = 200.0;
|
||||
let damping = 100.0;
|
||||
joint = joint.motor_position(3.14 / 2.0, stiffness, damping);
|
||||
joint = joint.motor_position(std::f32::consts::FRAC_PI_2, stiffness, damping);
|
||||
}
|
||||
|
||||
if i == 1 {
|
||||
@@ -541,7 +541,7 @@ fn create_actuated_spherical_joints(
|
||||
colliders.insert_with_parent(collider, child_handle, bodies);
|
||||
|
||||
if i > 0 {
|
||||
let mut joint = joint_template.clone();
|
||||
let mut joint = joint_template;
|
||||
|
||||
if i == 1 {
|
||||
joint = joint
|
||||
@@ -554,7 +554,12 @@ fn create_actuated_spherical_joints(
|
||||
joint = joint
|
||||
.motor_position(JointAxis::AngX, 0.0, stiffness, damping)
|
||||
.motor_position(JointAxis::AngY, 1.0, stiffness, damping)
|
||||
.motor_position(JointAxis::AngZ, 3.14 / 2.0, stiffness, damping);
|
||||
.motor_position(
|
||||
JointAxis::AngZ,
|
||||
std::f32::consts::FRAC_PI_2,
|
||||
stiffness,
|
||||
damping,
|
||||
);
|
||||
}
|
||||
|
||||
if use_articulations {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -67,7 +67,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
let collider = ColliderBuilder::cuboid(0.15, 0.3, 0.15);
|
||||
colliders.insert_with_parent(collider, character_handle, &mut bodies);
|
||||
|
||||
testbed.set_initial_body_color(character_handle, [255. / 255., 131. / 255., 244.0 / 255.]);
|
||||
testbed.set_initial_body_color(character_handle, [1., 131. / 255., 244.0 / 255.]);
|
||||
|
||||
/*
|
||||
* Tethered Ball
|
||||
|
||||
@@ -32,9 +32,11 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
let collider = ColliderBuilder::cuboid(hw * 2.0, hh, hw).density(100.0);
|
||||
colliders.insert_with_parent(collider, vehicle_handle, &mut bodies);
|
||||
|
||||
let mut tuning = WheelTuning::default();
|
||||
tuning.suspension_stiffness = 100.0;
|
||||
tuning.suspension_damping = 10.0;
|
||||
let tuning = WheelTuning {
|
||||
suspension_stiffness: 100.0,
|
||||
suspension_damping: 10.0,
|
||||
..WheelTuning::default()
|
||||
};
|
||||
let mut vehicle = DynamicRayCastVehicleController::new(vehicle_handle);
|
||||
let wheel_positions = [
|
||||
point![hw * 1.5, -hh, hw],
|
||||
|
||||
Reference in New Issue
Block a user