Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
stelzo committed May 9, 2024
1 parent 14eb60f commit 16e561d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
12 changes: 5 additions & 7 deletions benches/roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn reflection_through_plane(
normal: &PointXYZ,
point_on_plane: &PointXYZ,
) -> PointXYZ {
let v = PointXYZ {
PointXYZ {
x: point.x
- 2.0
* ((point.x - point_on_plane.x) * normal.x
Expand All @@ -52,8 +52,7 @@ pub fn reflection_through_plane(
* ((point.x - point_on_plane.x) * normal.x
+ (point.y - point_on_plane.y) * normal.y
+ (point.z - point_on_plane.z) * normal.z),
};
v
}
}

pub fn rotation_about_x(point: &PointXYZ, angle: f32) -> PointXYZ {
Expand All @@ -71,7 +70,7 @@ pub fn closest_point_on_line(
line_point: &PointXYZ,
line_direction: &PointXYZ,
) -> PointXYZ {
let v = PointXYZ {
PointXYZ {
x: line_point.x
+ (line_point.x - point.x) * ((line_point.x - point.x).powi(2))
/ ((line_direction.x * 2.0).powi(2))
Expand All @@ -87,8 +86,7 @@ pub fn closest_point_on_line(
/ ((line_direction.z * 2.0).powi(2))
+ (line_direction.y * 2.0) * (point.y - line_point.y)
/ ((line_direction.y * 2.0).powi(2)),
};
v
}
}

fn minus(point1: &PointXYZ, point2: &PointXYZ) -> PointXYZ {
Expand Down Expand Up @@ -153,7 +151,7 @@ pub fn heavy_computing(point: &PointXYZ, iterations: u32) -> f32 {
y: 11.0,
z: 12.0,
},
3.14159,
std::f32::consts::PI / 2.0,
);

result += magnitude_squared(&minus(&reflected_point, &rotated_point));
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,19 +234,19 @@ impl PointCloud2Msg {
datatype,
size,
} => {
if (*msg_f).name != *name {
if msg_f.name != *name {
return Err(MsgConversionError::FieldNotFound(vec![name.clone()]));
}

if (*msg_f).datatype != *datatype {
if msg_f.datatype != *datatype {
return Err(MsgConversionError::InvalidFieldFormat);
}

if (*msg_f).offset != offset {
if msg_f.offset != offset {
return Err(MsgConversionError::DataLengthMismatch);
}

if (*msg_f).count != 1 {
if msg_f.count != 1 {
return Err(MsgConversionError::DataLengthMismatch);
}

Expand Down

0 comments on commit 16e561d

Please sign in to comment.