From ff3522a711f2f1b207abecb9215238083205b079 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Sun, 20 Oct 2013 01:00:44 +1100 Subject: [PATCH] Replace usages of fmt! with format! --- src/cgmath/angle.rs | 8 ++++---- src/cgmath/point.rs | 9 +++++---- src/cgmath/quaternion.rs | 5 +++-- src/cgmath/vector.rs | 13 +++++++------ 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/cgmath/angle.rs b/src/cgmath/angle.rs index 38a1ec9..9e23bfe 100644 --- a/src/cgmath/angle.rs +++ b/src/cgmath/angle.rs @@ -15,11 +15,11 @@ //! Angle units for type-safe, self-documenting code. -pub use std::num::{cast, zero}; pub use std::num::{sinh, cosh, tanh}; pub use std::num::{asinh, acosh, atanh}; -use std::num::Zero; +use std::fmt; +use std::num::{Zero, zero, cast}; #[deriving(Clone, Eq, Ord, Zero)] pub struct Rad { s: S } #[deriving(Clone, Eq, Ord, Zero)] pub struct Deg { s: S } @@ -180,8 +180,8 @@ impl Angle for Deg { #[inline] pub fn atan(s: S) -> Rad { rad(s.atan()) } #[inline] pub fn atan2(a: S, b: S) -> Rad { rad(a.atan2(&b)) } -impl ToStr for Rad { fn to_str(&self) -> ~str { fmt!("%? rad", self.s) } } -impl ToStr for Deg { fn to_str(&self) -> ~str { fmt!("%?°", self.s) } } +impl ToStr for Rad { fn to_str(&self) -> ~str { format!("{} rad", self.s) } } +impl ToStr for Deg { fn to_str(&self) -> ~str { format!("{}°", self.s) } } impl ApproxEq for Rad { #[inline] diff --git a/src/cgmath/point.rs b/src/cgmath/point.rs index e611e00..bc2cfb6 100644 --- a/src/cgmath/point.rs +++ b/src/cgmath/point.rs @@ -17,6 +17,7 @@ //! disinguishes them from vectors, which have a length and direction, but do //! not have a fixed position. +use std::fmt; use std::num::zero; use array::*; @@ -88,14 +89,14 @@ array!(impl Point3 -> [S, ..3] _3) impl Point, [S, ..2]> for Point2 {} impl Point, [S, ..3]> for Point3 {} -impl ToStr for Point2 { +impl ToStr for Point2 { fn to_str(&self) -> ~str { - fmt!("[%?, %?]", self.x, self.y) + format!("[{}, {}]", self.x, self.y) } } -impl ToStr for Point3 { +impl ToStr for Point3 { fn to_str(&self) -> ~str { - fmt!("[%?, %?, %?]", self.x, self.y, self.z) + format!("[{}, {}, {}]", self.x, self.y, self.z) } } diff --git a/src/cgmath/quaternion.rs b/src/cgmath/quaternion.rs index 3407011..0e94329 100644 --- a/src/cgmath/quaternion.rs +++ b/src/cgmath/quaternion.rs @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::fmt; use std::num::{zero, one, cast, sqrt}; use angle::{Angle, Rad, acos, cos, sin, sin_cos}; @@ -296,8 +297,8 @@ impl Neg> for Quat { } } -impl ToStr for Quat { +impl ToStr for Quat { fn to_str(&self) -> ~str { - fmt!("%? + %?i + %?j + %?k", self.s, self.v.x, self.v.y, self.v.z) + format!("{} + {}i + {}j + {}k", self.s, self.v.x, self.v.y, self.v.z) } } diff --git a/src/cgmath/vector.rs b/src/cgmath/vector.rs index 713fb84..bc8f8b5 100644 --- a/src/cgmath/vector.rs +++ b/src/cgmath/vector.rs @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::fmt; use std::num::{Zero, zero, One, one, sqrt}; use angle::{Rad, atan2, acos}; @@ -282,20 +283,20 @@ impl EuclideanVector for Vec4 { } } -impl ToStr for Vec2 { +impl ToStr for Vec2 { fn to_str(&self) -> ~str { - fmt!("[%?, %?]", self.x, self.y) + format!("[{}, {}]", self.x, self.y) } } -impl ToStr for Vec3 { +impl ToStr for Vec3 { fn to_str(&self) -> ~str { - fmt!("[%?, %?, %?]", self.x, self.y, self.z) + format!("[{}, {}, {}]", self.x, self.y, self.z) } } -impl ToStr for Vec4 { +impl ToStr for Vec4 { fn to_str(&self) -> ~str { - fmt!("[%?, %?, %?, %?]", self.x, self.y, self.z, self.w) + format!("[{}, {}, {}, {}]", self.x, self.y, self.z, self.w) } }