From 88d0f19b39cc57b0be1a2dece3c6197900b46f4c Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Wed, 4 Sep 2024 00:15:21 +0700 Subject: [PATCH] Fix `clippy::semicolon_if_nothing_returned` lints (#533) --- src/box2d.rs | 8 ++++---- src/box3d.rs | 12 ++++++------ src/length.rs | 4 ++-- src/lib.rs | 1 + src/point.rs | 12 ++++++------ src/rect.rs | 2 +- src/scale.rs | 2 +- src/vector.rs | 16 ++++++++-------- 8 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/box2d.rs b/src/box2d.rs index 78eb339..e49b1c0 100644 --- a/src/box2d.rs +++ b/src/box2d.rs @@ -375,16 +375,16 @@ where for point in points { let p = point.borrow(); if p.x < min_x { - min_x = p.x + min_x = p.x; } if p.x > max_x { - max_x = p.x + max_x = p.x; } if p.y < min_y { - min_y = p.y + min_y = p.y; } if p.y > max_y { - max_y = p.y + max_y = p.y; } } diff --git a/src/box3d.rs b/src/box3d.rs index c6be577..8117029 100644 --- a/src/box3d.rs +++ b/src/box3d.rs @@ -342,22 +342,22 @@ where for point in points { let p = point.borrow(); if p.x < min_x { - min_x = p.x + min_x = p.x; } if p.x > max_x { - max_x = p.x + max_x = p.x; } if p.y < min_y { - min_y = p.y + min_y = p.y; } if p.y > max_y { - max_y = p.y + max_y = p.y; } if p.z < min_z { - min_z = p.z + min_z = p.z; } if p.z > max_z { - max_z = p.z + max_z = p.z; } } diff --git a/src/length.rs b/src/length.rs index 8a1305d..840cb12 100644 --- a/src/length.rs +++ b/src/length.rs @@ -273,7 +273,7 @@ impl Mul for Length { impl, U> MulAssign for Length { #[inline] fn mul_assign(&mut self, scale: T) { - *self = *self * scale + *self = *self * scale; } } @@ -291,7 +291,7 @@ impl Div for Length { impl, U> DivAssign for Length { #[inline] fn div_assign(&mut self, scale: T) { - *self = *self / scale + *self = *self / scale; } } diff --git a/src/lib.rs b/src/lib.rs index ec7f52f..36e471e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,6 +39,7 @@ //! foreign function interfaces (provided the underlying scalar type is also `repr(C)`). //! #![deny(unconditional_recursion)] +#![warn(clippy::semicolon_if_nothing_returned)] pub use crate::angle::Angle; pub use crate::box2d::Box2D; diff --git a/src/point.rs b/src/point.rs index eb6eb69..089c92d 100644 --- a/src/point.rs +++ b/src/point.rs @@ -590,7 +590,7 @@ impl Add> for Point2D { impl, U> AddAssign> for Point2D { #[inline] fn add_assign(&mut self, other: Vector2D) { - *self = *self + other + *self = *self + other; } } @@ -632,7 +632,7 @@ impl Sub> for Point2D { impl, U> SubAssign> for Point2D { #[inline] fn sub_assign(&mut self, other: Vector2D) { - *self = *self - other + *self = *self - other; } } @@ -648,7 +648,7 @@ impl Mul for Point2D { impl, U> MulAssign for Point2D { #[inline] fn mul_assign(&mut self, scale: T) { - *self = *self * scale + *self = *self * scale; } } @@ -681,7 +681,7 @@ impl Div for Point2D { impl, U> DivAssign for Point2D { #[inline] fn div_assign(&mut self, scale: T) { - *self = *self / scale + *self = *self / scale; } } @@ -1424,7 +1424,7 @@ impl Add> for Point3D { impl, U> AddAssign> for Point3D { #[inline] fn add_assign(&mut self, other: Vector3D) { - *self = *self + other + *self = *self + other; } } @@ -1471,7 +1471,7 @@ impl Sub> for Point3D { impl, U> SubAssign> for Point3D { #[inline] fn sub_assign(&mut self, other: Vector3D) { - *self = *self - other + *self = *self - other; } } diff --git a/src/rect.rs b/src/rect.rs index 034b7b4..8bdc8f0 100644 --- a/src/rect.rs +++ b/src/rect.rs @@ -905,7 +905,7 @@ mod tests { } y += 0.1; } - x += 0.1 + x += 0.1; } } diff --git a/src/scale.rs b/src/scale.rs index da1b7d6..0a4d2c0 100644 --- a/src/scale.rs +++ b/src/scale.rs @@ -416,7 +416,7 @@ impl Default for Scale { impl Hash for Scale { fn hash(&self, state: &mut H) { - self.0.hash(state) + self.0.hash(state); } } diff --git a/src/vector.rs b/src/vector.rs index e3f5c41..9ce9026 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -788,7 +788,7 @@ impl<'a, T: 'a + Add + Copy + Zero, U: 'a> Sum<&'a Self> for Vector2 impl, U> AddAssign for Vector2D { #[inline] fn add_assign(&mut self, other: Self) { - *self = *self + other + *self = *self + other; } } @@ -804,7 +804,7 @@ impl Sub for Vector2D { impl, U> SubAssign> for Vector2D { #[inline] fn sub_assign(&mut self, other: Self) { - *self = *self - other + *self = *self - other; } } @@ -820,7 +820,7 @@ impl Mul for Vector2D { impl, U> MulAssign for Vector2D { #[inline] fn mul_assign(&mut self, scale: T) { - *self = *self * scale + *self = *self * scale; } } @@ -853,7 +853,7 @@ impl Div for Vector2D { impl, U> DivAssign for Vector2D { #[inline] fn div_assign(&mut self, scale: T) { - *self = *self / scale + *self = *self / scale; } } @@ -1713,7 +1713,7 @@ impl<'a, T: 'a + Add + Copy + Zero, U: 'a> Sum<&'a Self> for Vector3 impl, U> AddAssign for Vector3D { #[inline] fn add_assign(&mut self, other: Self) { - *self = *self + other + *self = *self + other; } } @@ -1729,7 +1729,7 @@ impl Sub for Vector3D { impl, U> SubAssign> for Vector3D { #[inline] fn sub_assign(&mut self, other: Self) { - *self = *self - other + *self = *self - other; } } @@ -1745,7 +1745,7 @@ impl Mul for Vector3D { impl, U> MulAssign for Vector3D { #[inline] fn mul_assign(&mut self, scale: T) { - *self = *self * scale + *self = *self * scale; } } @@ -1779,7 +1779,7 @@ impl Div for Vector3D { impl, U> DivAssign for Vector3D { #[inline] fn div_assign(&mut self, scale: T) { - *self = *self / scale + *self = *self / scale; } }