Fixed clippy warnings in math3d.

This commit is contained in:
Nathan Vegdahl 2018-12-15 21:56:48 -08:00
parent 8b6181d262
commit f2e591a91f
2 changed files with 13 additions and 6 deletions

View File

@ -14,7 +14,6 @@ pub use self::vector::Vector;
/// Trait for calculating dot products. /// Trait for calculating dot products.
pub trait DotProduct { pub trait DotProduct {
#[inline]
fn dot(self, other: Self) -> f32; fn dot(self, other: Self) -> f32;
} }
@ -25,7 +24,6 @@ pub fn dot<T: DotProduct>(a: T, b: T) -> f32 {
/// Trait for calculating cross products. /// Trait for calculating cross products.
pub trait CrossProduct { pub trait CrossProduct {
#[inline]
fn cross(self, other: Self) -> Self; fn cross(self, other: Self) -> Self;
} }

View File

@ -33,6 +33,8 @@ impl Matrix4x4 {
/// i j k l /// i j k l
/// m n o p /// m n o p
#[inline] #[inline]
#[allow(clippy::many_single_char_names)]
#[allow(clippy::too_many_arguments)]
pub fn new_from_values( pub fn new_from_values(
a: f32, a: f32,
b: f32, b: f32,
@ -103,7 +105,7 @@ impl Matrix4x4 {
} }
} }
return result; result
} }
/// Returns the transpose of the matrix /// Returns the transpose of the matrix
@ -116,6 +118,7 @@ impl Matrix4x4 {
/// Returns the inverse of the Matrix /// Returns the inverse of the Matrix
#[inline] #[inline]
#[allow(clippy::float_cmp)]
pub fn inverse(&self) -> Matrix4x4 { pub fn inverse(&self) -> Matrix4x4 {
let mut m = *self; let mut m = *self;
let det = invert(&mut m.values); let det = invert(&mut m.values);
@ -128,14 +131,14 @@ impl Index<usize> for Matrix4x4 {
type Output = Float4; type Output = Float4;
#[inline(always)] #[inline(always)]
fn index<'a>(&'a self, _index: usize) -> &'a Float4 { fn index(&self, _index: usize) -> &Float4 {
&self.values[_index] &self.values[_index]
} }
} }
impl IndexMut<usize> for Matrix4x4 { impl IndexMut<usize> for Matrix4x4 {
#[inline(always)] #[inline(always)]
fn index_mut<'a>(&'a mut self, _index: usize) -> &'a mut Float4 { fn index_mut(&mut self, _index: usize) -> &mut Float4 {
&mut self.values[_index] &mut self.values[_index]
} }
} }
@ -151,7 +154,13 @@ impl PartialEq for Matrix4x4 {
} }
} }
return result; result
}
}
impl Default for Matrix4x4 {
fn default() -> Self {
Self::new()
} }
} }