@@ -15,7 +15,9 @@ The `ToStr` trait for converting to strings
15
15
*/
16
16
17
17
use str;
18
+ use str:: OwnedStr ;
18
19
use hashmap:: HashMap ;
20
+ use hashmap:: HashSet ;
19
21
use container:: Map ;
20
22
use hash:: Hash ;
21
23
use cmp:: Eq ;
@@ -59,13 +61,13 @@ impl<A:ToStr+Hash+Eq, B:ToStr+Hash+Eq> ToStr for HashMap<A, B> {
59
61
first = false;
60
62
}
61
63
else {
62
- str:: push_str(&mut acc, ~ " , ");
64
+ acc. push_str(" , ");
63
65
}
64
- str:: push_str(&mut acc, key.to_str());
65
- str:: push_str(&mut acc, ~" : ");
66
- str:: push_str(&mut acc, value.to_str());
66
+ acc. push_str(key.to_str());
67
+ acc. push_str(" : ");
68
+ acc. push_str(value.to_str());
67
69
}
68
- str:: push_char(&mut acc, '}');
70
+ acc. push_char('}');
69
71
acc
70
72
}
71
73
}
@@ -82,6 +84,7 @@ impl<A:ToStr,B:ToStr> ToStr for (A, B) {
82
84
}
83
85
}
84
86
}
87
+
85
88
impl < A : ToStr , B : ToStr , C : ToStr > ToStr for ( A , B , C ) {
86
89
#[ inline( always) ]
87
90
fn to_str ( & self ) -> ~str {
@@ -185,7 +188,7 @@ mod tests {
185
188
186
189
let table_str = table.to_str();
187
190
188
- assert!(table_str == ~" { 1 : 2 , 3 : 4 } " || table_str == ~" { 3 : 4 , 1 : 2 } ");
191
+ assert!(table_str == ~" { 1 : 2 , 3 : 4 } " || table_str == ~" { 3 : 4 , 1 : 2 } ");
189
192
assert!(empty.to_str() == ~" { } " ) ;
190
193
}
191
194
}
0 commit comments