Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
trumank committed Nov 4, 2024
1 parent 0370c5a commit fcb3f13
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions hook/src/hooks/debug_drawing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,7 @@ unsafe extern "system" fn exec_draw_debug_sphere(
let mut cos_y1 = 1.0;
let center: Vector3<f32> = center.into();

let mut lines = Vec::new();
lines.reserve(num_segments_y as usize * segments as usize * 2);
let mut lines = Vec::with_capacity(num_segments_y as usize * segments as usize * 2);

while num_segments_y > 0 {
let sin_y2 = latitude.sin();
Expand Down Expand Up @@ -493,16 +492,16 @@ unsafe fn draw_cone(

let num_sides = num_sides.max(4) as usize;

let angle1 = angle_height.clamp(std::f32::EPSILON, std::f32::consts::PI - std::f32::EPSILON);
let angle2 = angle_width.clamp(std::f32::EPSILON, std::f32::consts::PI - std::f32::EPSILON);
let angle1 = angle_height.clamp(f32::EPSILON, std::f32::consts::PI - f32::EPSILON);
let angle2 = angle_width.clamp(f32::EPSILON, std::f32::consts::PI - f32::EPSILON);

let sin_x_2 = (0.5 * angle1).sin();
let sin_y_2 = (0.5 * angle2).sin();

let sin_sq_x_2 = sin_x_2 * sin_x_2;
let sin_sq_y_2 = sin_y_2 * sin_y_2;

let mut cone_verts = Vec::with_capacity(num_sides as usize);
let mut cone_verts = Vec::with_capacity(num_sides);

for i in 0..num_sides {
let fraction = i as f32 / num_sides as f32;
Expand Down Expand Up @@ -540,8 +539,8 @@ unsafe fn draw_cone(
let mut current_point = Vector3::zeros();
let mut prev_point = Vector3::zeros();
let mut first_point = Vector3::zeros();
for i in 0..num_sides {
current_point = cone_to_world.transform_point(&cone_verts[i].into()).coords;
for (i, vert) in cone_verts.iter().enumerate().take(num_sides) {
current_point = cone_to_world.transform_point(&(*vert).into()).coords;
lines.push(FBatchedLine {
start: get_origin(&cone_to_world).into(),
end: current_point.into(),
Expand Down

0 comments on commit fcb3f13

Please sign in to comment.