about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-06-13 14:42:03 +0000
committerbors <bors@rust-lang.org>2014-06-13 14:42:03 +0000
commit0422934e243ed57a7662ec878db9d4e01ca5b0f9 (patch)
tree5e7bcd1009b105bae30dac48beb5ffed9a53f256 /src/libcollections
parentc119903f621a11643d5f299423a2c72eefffec4c (diff)
parentcac7a2053aba7be214d5e58e13867089638a8f50 (diff)
downloadrust-0422934e243ed57a7662ec878db9d4e01ca5b0f9.tar.gz
rust-0422934e243ed57a7662ec878db9d4e01ca5b0f9.zip
auto merge of #14831 : alexcrichton/rust/format-intl, r=brson
* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/bitv.rs14
-rw-r--r--src/libcollections/smallintmap.rs12
-rw-r--r--src/libcollections/treemap.rs24
3 files changed, 50 insertions, 0 deletions
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs
index e100baa1e3a..c0b3dec086b 100644
--- a/src/libcollections/bitv.rs
+++ b/src/libcollections/bitv.rs
@@ -842,6 +842,7 @@ impl cmp::PartialEq for BitvSet {
 }
 
 impl fmt::Show for BitvSet {
+    #[cfg(stage0)]
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         try!(write!(fmt, r"\{"));
         let mut first = true;
@@ -854,6 +855,19 @@ impl fmt::Show for BitvSet {
         }
         write!(fmt, r"\}")
     }
+    #[cfg(not(stage0))]
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+        try!(write!(fmt, "{{"));
+        let mut first = true;
+        for n in self.iter() {
+            if !first {
+                try!(write!(fmt, ", "));
+            }
+            try!(write!(fmt, "{}", n));
+            first = false;
+        }
+        write!(fmt, "}}")
+    }
 }
 
 impl<S: hash::Writer> hash::Hash<S> for BitvSet {
diff --git a/src/libcollections/smallintmap.rs b/src/libcollections/smallintmap.rs
index 6b4982de082..06c1516f1e0 100644
--- a/src/libcollections/smallintmap.rs
+++ b/src/libcollections/smallintmap.rs
@@ -185,6 +185,7 @@ impl<V:Clone> SmallIntMap<V> {
 }
 
 impl<V: fmt::Show> fmt::Show for SmallIntMap<V> {
+    #[cfg(stage0)]
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         try!(write!(f, r"\{"));
 
@@ -195,6 +196,17 @@ impl<V: fmt::Show> fmt::Show for SmallIntMap<V> {
 
         write!(f, r"\}")
     }
+    #[cfg(not(stage0))]
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        try!(write!(f, "{{"));
+
+        for (i, (k, v)) in self.iter().enumerate() {
+            if i != 0 { try!(write!(f, ", ")); }
+            try!(write!(f, "{}: {}", k, *v));
+        }
+
+        write!(f, "}}")
+    }
 }
 
 macro_rules! iterator {
diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs
index 1f4ee52008c..b59caa9375e 100644
--- a/src/libcollections/treemap.rs
+++ b/src/libcollections/treemap.rs
@@ -76,6 +76,7 @@ impl<K: PartialOrd + Ord, V: PartialOrd> PartialOrd for TreeMap<K, V> {
 }
 
 impl<K: Ord + Show, V: Show> Show for TreeMap<K, V> {
+    #[cfg(stage0)]
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         try!(write!(f, r"\{"));
 
@@ -86,6 +87,17 @@ impl<K: Ord + Show, V: Show> Show for TreeMap<K, V> {
 
         write!(f, r"\}")
     }
+    #[cfg(not(stage0))]
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        try!(write!(f, "{{"));
+
+        for (i, (k, v)) in self.iter().enumerate() {
+            if i != 0 { try!(write!(f, ", ")); }
+            try!(write!(f, "{}: {}", *k, *v));
+        }
+
+        write!(f, "}}")
+    }
 }
 
 impl<K: Ord, V> Collection for TreeMap<K, V> {
@@ -574,6 +586,7 @@ impl<T: PartialOrd + Ord> PartialOrd for TreeSet<T> {
 }
 
 impl<T: Ord + Show> Show for TreeSet<T> {
+    #[cfg(stage0)]
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         try!(write!(f, r"\{"));
 
@@ -584,6 +597,17 @@ impl<T: Ord + Show> Show for TreeSet<T> {
 
         write!(f, r"\}")
     }
+    #[cfg(not(stage0))]
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        try!(write!(f, "{{"));
+
+        for (i, x) in self.iter().enumerate() {
+            if i != 0 { try!(write!(f, ", ")); }
+            try!(write!(f, "{}", *x));
+        }
+
+        write!(f, "}}")
+    }
 }
 
 impl<T: Ord> Collection for TreeSet<T> {