Skip to content

Commit 647aba5

Browse files
authored
Merge pull request #12 from remilauzier/master
Fix some clippy warnings
2 parents 023321c + 2e1db8f commit 647aba5

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/lib.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![deny(missing_docs)]
22

33
//! Traits for generic floats in game programming
4-
use std::ops::*;
4+
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, RemAssign, Sub, SubAssign};
55

66
/// Convenience trait for floats.
77
pub trait Float:
@@ -138,12 +138,12 @@ impl Radians for f32 {
138138

139139
#[inline(always)]
140140
fn deg_to_rad(self) -> Self {
141-
self * (::std::f32::consts::PI / 180.0f32)
141+
self * (::std::f32::consts::PI / 180.0_f32)
142142
}
143143

144144
#[inline(always)]
145145
fn rad_to_deg(self) -> Self {
146-
self * (180.0f32 / ::std::f32::consts::PI)
146+
self * (180.0_f32 / ::std::f32::consts::PI)
147147
}
148148
}
149149

@@ -165,12 +165,12 @@ impl Radians for f64 {
165165

166166
#[inline(always)]
167167
fn deg_to_rad(self) -> Self {
168-
self * (::std::f64::consts::PI / 180.0f64)
168+
self * (::std::f64::consts::PI / 180.0_f64)
169169
}
170170

171171
#[inline(always)]
172172
fn rad_to_deg(self) -> Self {
173-
self * (180.0f64 / ::std::f64::consts::PI)
173+
self * (180.0_f64 / ::std::f64::consts::PI)
174174
}
175175
}
176176

@@ -407,29 +407,29 @@ mod test {
407407

408408
#[test]
409409
fn test_f32_sqrt() {
410-
let a = 4.0f32;
410+
let a = 4.0_f32;
411411
let b = <f32 as Sqrt>::sqrt(a);
412-
assert_eq!(b, 2.0f32);
412+
assert!((b - 2.0_f32).abs() < f32::EPSILON)
413413
}
414414

415415
#[test]
416416
fn test_f64_sqrt() {
417-
let a = 4.0f64;
417+
let a = 4.0_f64;
418418
let b = <f64 as Sqrt>::sqrt(a);
419-
assert_eq!(b, 2.0f64);
419+
assert!((b - 2.0_f64).abs() < f64::EPSILON)
420420
}
421421

422422
#[test]
423423
fn test_f32_deg_to_rad() {
424-
let degrees = 23.0f32;
424+
let degrees = 23.0_f32;
425425
let radians = degrees.deg_to_rad();
426-
assert!((radians - 0.401425).abs() > ::std::f32::EPSILON);
426+
assert!((radians - 0.401_425).abs() > f32::EPSILON);
427427
}
428428

429429
#[test]
430430
fn test_f64_deg_to_rad() {
431-
let degrees = 60.0f64;
431+
let degrees = 60.0_f64;
432432
let radians = degrees.deg_to_rad();
433-
assert!((radians - 1.047197).abs() > ::std::f64::EPSILON);
433+
assert!((radians - std::f64::consts::FRAC_PI_3).abs() == f64::EPSILON);
434434
}
435435
}

0 commit comments

Comments
 (0)