From d5742d75ded7ebfdb5a393e5f6fef349573824ba Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Sun, 4 Jan 2015 10:27:01 +1300 Subject: [PATCH] upstream rust: std::{ops,cmp} traits no longer in prelude --- src/lib.rs | 2 ++ src/linalg/decompositions.rs | 1 + src/structs/dmat.rs | 1 + src/structs/dvec.rs | 1 + src/structs/iso.rs | 1 + src/structs/mat.rs | 1 + src/structs/pnt.rs | 1 + src/structs/quat.rs | 1 + src/structs/rot.rs | 1 + src/structs/spec/identity.rs | 1 + src/structs/spec/mat.rs | 1 + src/structs/spec/vec.rs | 1 + src/structs/spec/vec0.rs | 1 + src/structs/vec.rs | 1 + src/traits/geometry.rs | 2 +- src/traits/operations.rs | 14 ++++++++------ src/traits/structure.rs | 1 + 17 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 506ddbb9..152fb02f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -92,6 +92,8 @@ extern crate "rustc-serialize" as rustc_serialize; extern crate test; use std::cmp; +use std::ops::Neg; + pub use traits::{ Absolute, AbsoluteRotate, diff --git a/src/linalg/decompositions.rs b/src/linalg/decompositions.rs index 5e1a410b..bbf143f2 100644 --- a/src/linalg/decompositions.rs +++ b/src/linalg/decompositions.rs @@ -1,3 +1,4 @@ +use std::ops::{Add,Sub,Mul}; use traits::operations::{Transpose, ApproxEq}; use traits::structure::{ColSlice, Eye, Indexable, Diag, SquareMat, BaseFloat}; use traits::geometry::Norm; diff --git a/src/structs/dmat.rs b/src/structs/dmat.rs index b98e4908..1aef2116 100644 --- a/src/structs/dmat.rs +++ b/src/structs/dmat.rs @@ -9,6 +9,7 @@ use std::rand; use traits::operations::ApproxEq; use std::mem; use structs::dvec::DVec; +use std::ops::{Index,IndexMut,Add,Sub,Mul,Div}; use traits::operations::{Inv, Transpose, Mean, Cov}; use traits::structure::{Cast, ColSlice, RowSlice, Diag, Eye, Indexable, Shape, Zero, One, BaseNum}; use std::fmt::{Show, Formatter, Result}; diff --git a/src/structs/dvec.rs b/src/structs/dvec.rs index 9118b374..72ff820a 100644 --- a/src/structs/dvec.rs +++ b/src/structs/dvec.rs @@ -7,6 +7,7 @@ use std::rand; use std::slice::{Iter, IterMut}; use std::iter::FromIterator; use std::iter::repeat; +use std::ops::{Index,IndexMut,Add,Sub,Mul,Div,Neg}; use traits::operations::{ApproxEq, Axpy}; use traits::geometry::{Dot, Norm}; use traits::structure::{Iterable, IterableMut, Indexable, Shape, BaseFloat, BaseNum, Zero, One}; diff --git a/src/structs/iso.rs b/src/structs/iso.rs index 7b237784..df1dd2dc 100644 --- a/src/structs/iso.rs +++ b/src/structs/iso.rs @@ -3,6 +3,7 @@ #![allow(missing_docs)] use std::rand::{Rand, Rng}; +use std::ops::{Add,Sub,Mul}; use structs::mat::{Mat3, Mat4, Mat5}; use traits::structure::{Cast, Dim, Col, BaseFloat, BaseNum, One}; use traits::operations::{Inv, ApproxEq}; diff --git a/src/structs/mat.rs b/src/structs/mat.rs index ab419a1b..c461e6ae 100644 --- a/src/structs/mat.rs +++ b/src/structs/mat.rs @@ -5,6 +5,7 @@ use std::mem; use traits::operations::ApproxEq; use std::slice::{Iter, IterMut}; +use std::ops::{Index,IndexMut,Add,Sub,Mul,Div}; use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec5, Vec6}; use structs::pnt::{Pnt1, Pnt4, Pnt5, Pnt6}; use structs::dvec::{DVec1, DVec2, DVec3, DVec4, DVec5, DVec6}; diff --git a/src/structs/pnt.rs b/src/structs/pnt.rs index a584f7a2..4f42ad71 100644 --- a/src/structs/pnt.rs +++ b/src/structs/pnt.rs @@ -5,6 +5,7 @@ use std::mem; use std::slice::{Iter, IterMut}; use std::iter::{Iterator, FromIterator}; +use std::ops::{Index,IndexMut,Add,Sub,Mul,Div,Neg}; use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv}; use traits::structure::{Cast, Dim, Indexable, Iterable, IterableMut, PntAsVec, Shape, diff --git a/src/structs/quat.rs b/src/structs/quat.rs index a37c2dac..5223588b 100644 --- a/src/structs/quat.rs +++ b/src/structs/quat.rs @@ -6,6 +6,7 @@ use std::mem; use std::num; use std::rand::{Rand, Rng}; use std::slice::{Iter, IterMut}; +use std::ops::{Index,IndexMut,Add,Sub,Mul,Div,Neg}; use structs::{Vec3, Pnt3, Rot3, Mat3}; use traits::operations::{ApproxEq, Inv, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv}; diff --git a/src/structs/rot.rs b/src/structs/rot.rs index 4569ad59..3e4492f9 100644 --- a/src/structs/rot.rs +++ b/src/structs/rot.rs @@ -3,6 +3,7 @@ #![allow(missing_docs)] use std::rand::{Rand, Rng}; +use std::ops::{Index,IndexMut,Mul,Neg}; use traits::geometry::{Rotate, Rotation, AbsoluteRotate, RotationMatrix, Transform, ToHomogeneous, Norm, Cross}; use traits::structure::{Cast, Dim, Row, Col, BaseFloat, BaseNum, Zero, One}; diff --git a/src/structs/spec/identity.rs b/src/structs/spec/identity.rs index 1370ac90..72d67268 100644 --- a/src/structs/spec/identity.rs +++ b/src/structs/spec/identity.rs @@ -1,4 +1,5 @@ use structs::mat; +use std::ops::{Mul}; use traits::operations::{Inv, Transpose}; use traits::structure::{Zero, One}; use traits::geometry::{Translation, Translate, Rotation, Rotate, Transformation, Transform, diff --git a/src/structs/spec/mat.rs b/src/structs/spec/mat.rs index c9bf9e43..ea2fef5a 100644 --- a/src/structs/spec/mat.rs +++ b/src/structs/spec/mat.rs @@ -1,3 +1,4 @@ +use std::ops::{Add,Mul}; use structs::vec::{Vec2, Vec3}; use structs::pnt::{Pnt2, Pnt3}; use structs::mat::{Mat1, Mat2, Mat3}; diff --git a/src/structs/spec/vec.rs b/src/structs/spec/vec.rs index c7937d12..7eb75255 100644 --- a/src/structs/spec/vec.rs +++ b/src/structs/spec/vec.rs @@ -1,3 +1,4 @@ +use std::ops::{Sub,Mul,Neg}; use traits::structure::{Cast, Row, Basis, BaseFloat, Zero, One}; use traits::geometry::{Norm, Cross, CrossMatrix, UniformSphereSample}; use structs::vec::{Vec1, Vec2, Vec3, Vec4}; diff --git a/src/structs/spec/vec0.rs b/src/structs/spec/vec0.rs index 36bd60f6..cd4e644a 100644 --- a/src/structs/spec/vec0.rs +++ b/src/structs/spec/vec0.rs @@ -1,6 +1,7 @@ use std::mem; use std::slice::{Iter, IterMut}; use std::iter::{Iterator, FromIterator}; +use std::ops::{Index,IndexMut,Add,Sub,Mul,Div,Neg}; use traits::operations::ApproxEq; use traits::structure::{Iterable, IterableMut, Indexable, Basis, Dim, Shape, BaseFloat, BaseNum, Zero, One, Bounded}; diff --git a/src/structs/vec.rs b/src/structs/vec.rs index 960f8c8a..e7e234a1 100644 --- a/src/structs/vec.rs +++ b/src/structs/vec.rs @@ -5,6 +5,7 @@ use std::mem; use std::slice::{Iter, IterMut}; use std::iter::{Iterator, FromIterator}; +use std::ops::{Index,IndexMut,Add,Sub,Mul,Div,Neg}; use traits::operations::{ApproxEq, POrd, POrdering, Axpy, ScalarAdd, ScalarSub, ScalarMul, ScalarDiv, Absolute}; use traits::geometry::{Transform, Rotate, FromHomogeneous, ToHomogeneous, Dot, Norm, diff --git a/src/traits/geometry.rs b/src/traits/geometry.rs index ac7306cc..424510f2 100644 --- a/src/traits/geometry.rs +++ b/src/traits/geometry.rs @@ -1,6 +1,6 @@ //! Traits of operations having a well-known or explicit geometric meaning. - +use std::ops::{Neg}; use traits::structure::{BaseFloat, Mat}; /// Trait of object which represent a translation, and to wich new translation diff --git a/src/traits/operations.rs b/src/traits/operations.rs index 8d914ef1..9a6d45ca 100644 --- a/src/traits/operations.rs +++ b/src/traits/operations.rs @@ -1,5 +1,7 @@ //! Low level operations on vectors and matrices. +use std::ops::{Mul}; +use std::cmp::{Ordering}; use std::num::{Float, SignedInt}; use traits::structure::SquareMat; @@ -50,9 +52,9 @@ impl POrdering { /// Creates a `POrdering` from an `Ordering`. pub fn from_ordering(ord: Ordering) -> POrdering { match ord { - Less => POrdering::PartialLess, - Equal => POrdering::PartialEqual, - Greater => POrdering::PartialGreater + Ordering::Less => POrdering::PartialLess, + Ordering::Equal => POrdering::PartialEqual, + Ordering::Greater => POrdering::PartialGreater } } @@ -61,9 +63,9 @@ impl POrdering { /// Returns `None` if `self` is `NotComparable`. pub fn to_ordering(self) -> Option { match self { - POrdering::PartialLess => Some(Less), - POrdering::PartialEqual => Some(Equal), - POrdering::PartialGreater => Some(Greater), + POrdering::PartialLess => Some(Ordering::Less), + POrdering::PartialEqual => Some(Ordering::Equal), + POrdering::PartialGreater => Some(Ordering::Greater), POrdering::NotComparable => None } } diff --git a/src/traits/structure.rs b/src/traits/structure.rs index 76a9beca..ab18af78 100644 --- a/src/traits/structure.rs +++ b/src/traits/structure.rs @@ -4,6 +4,7 @@ use std::f32; use std::f64; use std::num::{Int, Float, FloatMath}; use std::slice::{Iter, IterMut}; +use std::ops::{Index,IndexMut,Add,Sub,Mul,Div,Rem,Neg}; use traits::operations::{RMul, LMul, Axpy, Transpose, Inv, Absolute}; use traits::geometry::{Dot, Norm, Orig};