aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-02-10 23:06:48 +0100
committerJulian T <julian@jtle.dk>2021-02-10 23:06:48 +0100
commit49c6adb0db70ffc30eaac33b66eacf7574b34e26 (patch)
tree60f828ce8abf962fe2d88fdeb4e04db1d7663253 /src/core
parent3a144c8c1fc83150fc06d792082db5cc4bce3cc5 (diff)
Fixed most clippy warnings
Diffstat (limited to 'src/core')
-rw-r--r--src/core/bound.rs2
-rw-r--r--src/core/vector2.rs2
-rw-r--r--src/core/vector3.rs6
3 files changed, 5 insertions, 5 deletions
diff --git a/src/core/bound.rs b/src/core/bound.rs
index 404424e..3978028 100644
--- a/src/core/bound.rs
+++ b/src/core/bound.rs
@@ -83,7 +83,7 @@ impl<T: Number> Bound2<T> {
/// ```
pub fn area(&self) -> T {
let diag = self.diagonal();
- return diag.x * diag.y;
+ diag.x * diag.y
}
}
diff --git a/src/core/vector2.rs b/src/core/vector2.rs
index 0e0165e..405b12a 100644
--- a/src/core/vector2.rs
+++ b/src/core/vector2.rs
@@ -112,7 +112,7 @@ impl Vector2i {
}
impl Vector2f {
- pub fn len(&self) -> Float {
+ pub fn length(&self) -> Float {
(self.x*self.x + self.y*self.y).sqrt()
}
diff --git a/src/core/vector3.rs b/src/core/vector3.rs
index 24b84e9..e26c07c 100644
--- a/src/core/vector3.rs
+++ b/src/core/vector3.rs
@@ -117,7 +117,7 @@ impl Vector3f {
self.x * self.x + self.y * self.y + self.z * self.z
}
- pub fn len(&self) -> Float {
+ pub fn length(&self) -> Float {
self.len_squared().sqrt()
}
@@ -137,7 +137,7 @@ impl Vector3f {
/// ```
pub fn norm_in(&mut self) {
// TODO Experiment with checking for normality with len_squared
- let len = self.len();
+ let len = self.length();
if len == 0.0 {
*self = Self::new(0.0);
}
@@ -146,7 +146,7 @@ impl Vector3f {
}
pub fn norm(&self) -> Self {
- let mut new = self.clone();
+ let mut new = *self;
new.norm_in();
new
}