Skip to content

Commit d5e765d

Browse files
authored
Merge pull request #548 from gents83/master
Fixing clippy warnings
2 parents 2e76e82 + 33fb2fd commit d5e765d

File tree

3 files changed

+20
-30
lines changed

3 files changed

+20
-30
lines changed

src/macros.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ macro_rules! default_fn {
2424

2525
#[cfg(not(feature = "simd"))]
2626
macro_rules! default_fn {
27-
{ $($tt:tt)* } => { fn $( $tt )* };
27+
{ $($tt:tt)* } => {
28+
#[inline]
29+
fn $( $tt )*
30+
};
2831
}
2932

3033
/// Generates a binary operator implementation for the permutations of by-ref and by-val
@@ -35,15 +38,13 @@ macro_rules! impl_operator {
3538
}) => {
3639
impl<$S: $Constraint> $Op for $Lhs {
3740
type Output = $Output;
38-
#[inline]
3941
default_fn!($op(self) -> $Output {
4042
let $x = self; $body
4143
});
4244
}
4345

4446
impl<'a, $S: $Constraint> $Op for &'a $Lhs {
4547
type Output = $Output;
46-
#[inline]
4748
default_fn!($op(self) -> $Output {
4849
let $x = self; $body
4950
});
@@ -55,15 +56,13 @@ macro_rules! impl_operator {
5556
}) => {
5657
impl<$S: $Constraint> $Op<$Rhs> for $Lhs {
5758
type Output = $Output;
58-
#[inline]
5959
default_fn!($op(self, other: $Rhs) -> $Output {
6060
let ($lhs, $rhs) = (self, other); $body
6161
});
6262
}
6363

6464
impl<'a, $S: $Constraint> $Op<$Rhs> for &'a $Lhs {
6565
type Output = $Output;
66-
#[inline]
6766
default_fn!($op(self, other: $Rhs) -> $Output {
6867
let ($lhs, $rhs) = (self, other); $body
6968
});
@@ -75,31 +74,27 @@ macro_rules! impl_operator {
7574
}) => {
7675
impl<$S: $Constraint> $Op<$Rhs> for $Lhs {
7776
type Output = $Output;
78-
#[inline]
7977
default_fn!( $op(self, other: $Rhs) -> $Output {
8078
let ($lhs, $rhs) = (self, other); $body
8179
});
8280
}
8381

8482
impl<'a, $S: $Constraint> $Op<&'a $Rhs> for $Lhs {
8583
type Output = $Output;
86-
#[inline]
8784
default_fn!( $op(self, other: &'a $Rhs) -> $Output {
8885
let ($lhs, $rhs) = (self, other); $body
8986
});
9087
}
9188

9289
impl<'a, $S: $Constraint> $Op<$Rhs> for &'a $Lhs {
9390
type Output = $Output;
94-
#[inline]
9591
default_fn!( $op(self, other: $Rhs) -> $Output {
9692
let ($lhs, $rhs) = (self, other); $body
9793
});
9894
}
9995

10096
impl<'a, 'b, $S: $Constraint> $Op<&'a $Rhs> for &'b $Lhs {
10197
type Output = $Output;
102-
#[inline]
10398
default_fn!( $op(self, other: &'a $Rhs) -> $Output {
10499
let ($lhs, $rhs) = (self, other); $body
105100
});
@@ -111,15 +106,13 @@ macro_rules! impl_operator {
111106
}) => {
112107
impl $Op<$Rhs<$S>> for $Lhs {
113108
type Output = $Output;
114-
#[inline]
115109
default_fn!( $op(self, other: $Rhs<$S>) -> $Output {
116110
let ($lhs, $rhs) = (self, other); $body
117111
});
118112
}
119113

120114
impl<'a> $Op<&'a $Rhs<$S>> for $Lhs {
121115
type Output = $Output;
122-
#[inline]
123116
default_fn!( $op(self, other: &'a $Rhs<$S>) -> $Output {
124117
let ($lhs, $rhs) = (self, other); $body
125118
});
@@ -132,7 +125,6 @@ macro_rules! impl_assignment_operator {
132125
fn $op:ident(&mut $lhs:ident, $rhs:ident) $body:block
133126
}) => {
134127
impl<$S: $Constraint + $Op<$S>> $Op<$Rhs> for $Lhs {
135-
#[inline]
136128
default_fn!( $op(&mut $lhs, $rhs: $Rhs) $body );
137129
}
138130
};

src/quaternion.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ impl<S: NumCast + Copy> Quaternion<S> {
238238
}
239239

240240
impl<S: BaseFloat> InnerSpace for Quaternion<S> {
241-
#[inline]
242241
default_fn!( dot(self, other: Quaternion<S>) -> S {
243242
self.s * other.s + self.v.dot(other.v)
244243
} );

src/vector.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ macro_rules! impl_vector {
209209
impl<S: Neg<Output = S>> Neg for $VectorN<S> {
210210
type Output = $VectorN<S>;
211211

212-
#[inline]
213212
default_fn!( neg(self) -> $VectorN<S> { $VectorN::new($(-self.$field),+) } );
214213
}
215214

@@ -309,30 +308,30 @@ macro_rules! impl_vector {
309308
});
310309

311310
impl<S: BaseNum> ElementWise for $VectorN<S> {
312-
#[inline] default_fn!( add_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field + rhs.$field),+) } );
313-
#[inline] default_fn!( sub_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field - rhs.$field),+) } );
314-
#[inline] default_fn!( mul_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field * rhs.$field),+) } );
315-
#[inline] default_fn!( div_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field / rhs.$field),+) } );
311+
default_fn!( add_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field + rhs.$field),+) } );
312+
default_fn!( sub_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field - rhs.$field),+) } );
313+
default_fn!( mul_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field * rhs.$field),+) } );
314+
default_fn!( div_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field / rhs.$field),+) } );
316315
#[inline] fn rem_element_wise(self, rhs: $VectorN<S>) -> $VectorN<S> { $VectorN::new($(self.$field % rhs.$field),+) }
317316

318-
#[inline] default_fn!( add_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field += rhs.$field);+ } );
319-
#[inline] default_fn!( sub_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field -= rhs.$field);+ } );
320-
#[inline] default_fn!( mul_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field *= rhs.$field);+ } );
321-
#[inline] default_fn!( div_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field /= rhs.$field);+ } );
317+
default_fn!( add_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field += rhs.$field);+ } );
318+
default_fn!( sub_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field -= rhs.$field);+ } );
319+
default_fn!( mul_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field *= rhs.$field);+ } );
320+
default_fn!( div_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field /= rhs.$field);+ } );
322321
#[inline] fn rem_assign_element_wise(&mut self, rhs: $VectorN<S>) { $(self.$field %= rhs.$field);+ }
323322
}
324323

325324
impl<S: BaseNum> ElementWise<S> for $VectorN<S> {
326-
#[inline] default_fn!( add_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field + rhs),+) } );
327-
#[inline] default_fn!( sub_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field - rhs),+) } );
328-
#[inline] default_fn!( mul_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field * rhs),+) } );
329-
#[inline] default_fn!( div_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field / rhs),+) } );
325+
default_fn!( add_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field + rhs),+) } );
326+
default_fn!( sub_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field - rhs),+) } );
327+
default_fn!( mul_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field * rhs),+) } );
328+
default_fn!( div_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field / rhs),+) } );
330329
#[inline] fn rem_element_wise(self, rhs: S) -> $VectorN<S> { $VectorN::new($(self.$field % rhs),+) }
331330

332-
#[inline] default_fn!( add_assign_element_wise(&mut self, rhs: S) { $(self.$field += rhs);+ } );
333-
#[inline] default_fn!( sub_assign_element_wise(&mut self, rhs: S) { $(self.$field -= rhs);+ } );
334-
#[inline] default_fn!( mul_assign_element_wise(&mut self, rhs: S) { $(self.$field *= rhs);+ } );
335-
#[inline] default_fn!( div_assign_element_wise(&mut self, rhs: S) { $(self.$field /= rhs);+ } );
331+
default_fn!( add_assign_element_wise(&mut self, rhs: S) { $(self.$field += rhs);+ } );
332+
default_fn!( sub_assign_element_wise(&mut self, rhs: S) { $(self.$field -= rhs);+ } );
333+
default_fn!( mul_assign_element_wise(&mut self, rhs: S) { $(self.$field *= rhs);+ } );
334+
default_fn!( div_assign_element_wise(&mut self, rhs: S) { $(self.$field /= rhs);+ } );
336335
#[inline] fn rem_assign_element_wise(&mut self, rhs: S) { $(self.$field %= rhs);+ }
337336
}
338337

0 commit comments

Comments
 (0)