Make clippy happier

This commit is contained in:
Jan Hohenheim
2023-02-04 23:42:04 +01:00
parent 95a7894b3c
commit 4ed3adda6e

View File

@@ -199,7 +199,7 @@ impl KinematicCharacterController {
colliders, colliders,
queries, queries,
character_shape, character_shape,
&character_pos, character_pos,
&dims, &dims,
filter, filter,
None, None,
@@ -259,7 +259,7 @@ impl KinematicCharacterController {
) { ) {
// No stairs, try to move along slopes. // No stairs, try to move along slopes.
if let Some(translation_on_slope) = if let Some(translation_on_slope) =
self.handle_slopes(&toi, &mut translation_remaining, offset) self.handle_slopes(&toi, &translation_remaining, offset)
{ {
translation_remaining = translation_on_slope; translation_remaining = translation_on_slope;
} else if allowed_dist.abs() < 1.0e5 { } else if allowed_dist.abs() < 1.0e5 {
@@ -499,17 +499,16 @@ impl KinematicCharacterController {
let angle_with_floor = self.up.angle(&hit.normal1); let angle_with_floor = self.up.angle(&hit.normal1);
let climbing = self.up.dot(&slope_translation) >= 0.0; let climbing = self.up.dot(&slope_translation) >= 0.0;
climbing if climbing {
.then(|| { // Are we allowed to climb?
(angle_with_floor <= self.max_slope_climb_angle) // Are we allowed to climb? (angle_with_floor <= self.max_slope_climb_angle).then_some(slope_translation)
.then_some(horizontal_translation) }
}) // Are we forced to slide?
.unwrap_or_else(|| { else if angle_with_floor >= self.min_slope_slide_angle {
(angle_with_floor >= self.min_slope_slide_angle) // Are we allowed to slide? slope_translation.into()
.then_some(slope_translation) } else {
.unwrap_or(horizontal_translation) horizontal_translation.into()
.into() }
})
} }
fn split_into_components(&self, translation: &Vector<Real>) -> [Vector<Real>; 2] { fn split_into_components(&self, translation: &Vector<Real>) -> [Vector<Real>; 2] {
@@ -659,7 +658,7 @@ impl KinematicCharacterController {
*translation_remaining -= horizontal_nudge; *translation_remaining -= horizontal_nudge;
result.translation += step + horizontal_nudge; result.translation += step + horizontal_nudge;
return true; true
} }
/// For a given collision between a character and its environment, this method will apply /// For a given collision between a character and its environment, this method will apply