From 16302ffa20a2ecc35f08e0ca89e3c56e9cdd5985 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Fri, 24 Apr 2015 23:28:31 -0400 Subject: [PATCH] Fixed the num crate --- Cargo.toml | 2 +- src/angle.rs | 2 +- src/approx.rs | 4 ++-- src/matrix.rs | 2 +- src/num.rs | 3 +-- src/projection.rs | 3 +-- src/quaternion.rs | 4 +--- src/vector.rs | 3 +-- 8 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a7e36f1..1666878 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cgmath" -version = "0.1.4" +version = "0.1.5" authors = ["Brendan Zabarauskas ", "Brian Heylin", "Colin Sherratt", diff --git a/src/angle.rs b/src/angle.rs index fa7191e..70f30c8 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -17,13 +17,13 @@ use std::fmt; use std::f64; -use std::num::cast; use std::ops::*; use rand::{Rand, Rng}; use rand::distributions::range::SampleRange; use rust_num::{Float, One, Zero, one, zero}; +use rust_num::traits::cast; use approx::ApproxEq; use num::BaseFloat; diff --git a/src/approx.rs b/src/approx.rs index 5a12903..9d72430 100644 --- a/src/approx.rs +++ b/src/approx.rs @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::num::{NumCast, cast}; -use rust_num::Float; +use rust_num::{Float, NumCast}; +use rust_num::traits::cast; pub trait ApproxEq: Sized { fn approx_epsilon(_hack: Option) -> T { diff --git a/src/matrix.rs b/src/matrix.rs index 4355630..3ea5a56 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -17,12 +17,12 @@ use std::fmt; use std::mem; -use std::num::cast; use std::ops::*; use rand::{Rand, Rng}; use rust_num::{Zero, zero, One, one}; +use rust_num::traits::cast; use angle::{Rad, sin, cos, sin_cos}; use approx::ApproxEq; diff --git a/src/num.rs b/src/num.rs index 9d68a2d..787edb0 100644 --- a/src/num.rs +++ b/src/num.rs @@ -17,9 +17,8 @@ use approx::ApproxEq; use std::cmp; use std::fmt; -use std::num::NumCast; -use rust_num::{Float, Num}; +use rust_num::{Float, Num, NumCast}; /// A trait providing a [partial ordering](http://mathworld.wolfram.com/PartialOrder.html). pub trait PartialOrd { diff --git a/src/projection.rs b/src/projection.rs index 639ca0d..6835ddf 100644 --- a/src/projection.rs +++ b/src/projection.rs @@ -13,9 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::num::cast; - use rust_num::{zero, one}; +use rust_num::traits::cast; use angle::{Angle, tan, cot}; use frustum::Frustum; diff --git a/src/quaternion.rs b/src/quaternion.rs index af6c822..f023efe 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -16,11 +16,11 @@ use std::f64; use std::fmt; use std::mem; -use std::num::cast; use std::ops::*; use rand::{Rand, Rng}; use rust_num::{Float, one, zero}; +use rust_num::traits::cast; use angle::{Angle, Rad, acos, sin, sin_cos, rad}; use approx::ApproxEq; @@ -242,8 +242,6 @@ impl Quaternion { /// - [Arcsynthesis OpenGL tutorial] /// (http://www.arcsynthesis.org/gltut/Positioning/Tut08%20Interpolation.html) pub fn slerp(&self, other: &Quaternion, amount: S) -> Quaternion { - use std::num::cast; - let dot = self.dot(other); let dot_threshold = cast(0.9995f64).unwrap(); diff --git a/src/vector.rs b/src/vector.rs index 4f72b93..f00e90a 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -98,12 +98,11 @@ use std::fmt; use std::mem; -use std::num::NumCast; use std::ops::*; use rand::{Rand, Rng}; -use rust_num::{Zero, One, zero, one}; +use rust_num::{NumCast, Zero, One, zero, one}; use angle::{Rad, atan2, acos}; use approx::ApproxEq;