Skip to content

Commit a02da4e

Browse files
committed
auto merge of #5063 : pcwalton/rust/plussing, r=pcwalton
2 parents 0aa1aaa + bf2a225 commit a02da4e

File tree

204 files changed

+729
-726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+729
-726
lines changed

src/libcore/at_vec.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub pure fn build_sized_opt<A>(size: Option<uint>,
9696

9797
// Appending
9898
#[inline(always)]
99-
pub pure fn append<T: Copy>(lhs: @[T], rhs: &[const T]) -> @[T] {
99+
pub pure fn append<T:Copy>(lhs: @[T], rhs: &[const T]) -> @[T] {
100100
do build_sized(lhs.len() + rhs.len()) |push| {
101101
for vec::each(lhs) |x| { push(*x); }
102102
for uint::range(0, rhs.len()) |i| { push(rhs[i]); }
@@ -132,7 +132,7 @@ pub pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> @[T] {
132132
* Creates an immutable vector of size `n_elts` and initializes the elements
133133
* to the value `t`.
134134
*/
135-
pub pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
135+
pub pure fn from_elem<T:Copy>(n_elts: uint, t: T) -> @[T] {
136136
do build_sized(n_elts) |push| {
137137
let mut i: uint = 0u;
138138
while i < n_elts { push(copy t); i += 1u; }
@@ -168,7 +168,7 @@ pub mod traits {
168168
use kinds::Copy;
169169
use ops::Add;
170170

171-
pub impl<T: Copy> Add<&[const T],@[T]> for @[T] {
171+
pub impl<T:Copy> Add<&[const T],@[T]> for @[T] {
172172
#[inline(always)]
173173
pure fn add(&self, rhs: & &self/[const T]) -> @[T] {
174174
append(*self, (*rhs))

src/libcore/cmp.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -56,41 +56,41 @@ pub trait Ord {
5656
}
5757

5858
#[inline(always)]
59-
pub pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool {
59+
pub pure fn lt<T:Ord>(v1: &T, v2: &T) -> bool {
6060
(*v1).lt(v2)
6161
}
6262

6363
#[inline(always)]
64-
pub pure fn le<T: Ord>(v1: &T, v2: &T) -> bool {
64+
pub pure fn le<T:Ord>(v1: &T, v2: &T) -> bool {
6565
(*v1).le(v2)
6666
}
6767

6868
#[inline(always)]
69-
pub pure fn eq<T: Eq>(v1: &T, v2: &T) -> bool {
69+
pub pure fn eq<T:Eq>(v1: &T, v2: &T) -> bool {
7070
(*v1).eq(v2)
7171
}
7272

7373
#[inline(always)]
74-
pub pure fn ne<T: Eq>(v1: &T, v2: &T) -> bool {
74+
pub pure fn ne<T:Eq>(v1: &T, v2: &T) -> bool {
7575
(*v1).ne(v2)
7676
}
7777

7878
#[inline(always)]
79-
pub pure fn ge<T: Ord>(v1: &T, v2: &T) -> bool {
79+
pub pure fn ge<T:Ord>(v1: &T, v2: &T) -> bool {
8080
(*v1).ge(v2)
8181
}
8282

8383
#[inline(always)]
84-
pub pure fn gt<T: Ord>(v1: &T, v2: &T) -> bool {
84+
pub pure fn gt<T:Ord>(v1: &T, v2: &T) -> bool {
8585
(*v1).gt(v2)
8686
}
8787

8888
#[inline(always)]
89-
pub pure fn min<T: Ord>(v1: T, v2: T) -> T {
89+
pub pure fn min<T:Ord>(v1: T, v2: T) -> T {
9090
if v1 < v2 { v1 } else { v2 }
9191
}
9292

9393
#[inline(always)]
94-
pub pure fn max<T: Ord>(v1: T, v2: T) -> T {
94+
pub pure fn max<T:Ord>(v1: T, v2: T) -> T {
9595
if v1 > v2 { v1 } else { v2 }
9696
}

src/libcore/dlist.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub pure fn from_elem<T>(data: T) -> @mut DList<T> {
106106
list
107107
}
108108
109-
pub fn from_vec<T: Copy>(vec: &[T]) -> @mut DList<T> {
109+
pub fn from_vec<T:Copy>(vec: &[T]) -> @mut DList<T> {
110110
do vec::foldl(DList(), vec) |list,data| {
111111
list.push(*data); // Iterating left-to-right -- add newly to the tail.
112112
list
@@ -457,7 +457,7 @@ impl<T> DList<T> {
457457
}
458458
}
459459

460-
impl<T: Copy> DList<T> {
460+
impl<T:Copy> DList<T> {
461461
/// Remove data from the head of the list. O(1).
462462
fn pop(@mut self) -> Option<T> {
463463
self.pop_n().map(|nobe| nobe.data)

src/libcore/dvec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl<A> DVec<A> {
227227
}
228228
}
229229
230-
impl<A: Copy> DVec<A> {
230+
impl<A:Copy> DVec<A> {
231231
/**
232232
* Append all elements of a vector to the end of the list
233233
*

src/libcore/either.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn either<T, U, V>(f_left: fn(&T) -> V,
4141
}
4242
}
4343

44-
pub fn lefts<T: Copy, U>(eithers: &[Either<T, U>]) -> ~[T] {
44+
pub fn lefts<T:Copy,U>(eithers: &[Either<T, U>]) -> ~[T] {
4545
//! Extracts from a vector of either all the left values
4646
4747
do vec::build_sized(eithers.len()) |push| {

src/libcore/hash.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub trait HashUtil {
5959
pure fn hash() -> u64;
6060
}
6161

62-
impl<A: Hash> HashUtil for A {
62+
impl<A:Hash> HashUtil for A {
6363
#[inline(always)]
6464
pure fn hash() -> u64 { self.hash_keyed(0,0) }
6565
}
@@ -74,7 +74,7 @@ pub trait Streaming {
7474
fn reset();
7575
}
7676

77-
impl<A: IterBytes> Hash for A {
77+
impl<A:IterBytes> Hash for A {
7878
#[inline(always)]
7979
pure fn hash_keyed(k0: u64, k1: u64) -> u64 {
8080
unsafe {

src/libcore/hashmap.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ pub mod linear {
5656
((capacity as float) * 3. / 4.) as uint
5757
}
5858

59-
pub fn linear_map_with_capacity<K: Eq Hash, V>(
59+
pub fn linear_map_with_capacity<K:Eq + Hash,V>(
6060
initial_capacity: uint) -> LinearMap<K, V> {
6161
let r = rand::task_rng();
6262
linear_map_with_capacity_and_keys(r.gen_u64(), r.gen_u64(),
6363
initial_capacity)
6464
}
6565

66-
pure fn linear_map_with_capacity_and_keys<K: Eq Hash, V>(
66+
pure fn linear_map_with_capacity_and_keys<K:Eq + Hash,V>(
6767
k0: u64, k1: u64,
6868
initial_capacity: uint) -> LinearMap<K, V> {
6969
LinearMap {
@@ -74,7 +74,7 @@ pub mod linear {
7474
}
7575
}
7676

77-
priv impl<K: Hash IterBytes Eq, V> LinearMap<K, V> {
77+
priv impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
7878
#[inline(always)]
7979
pure fn to_bucket(&self, h: uint) -> uint {
8080
// A good hash function with entropy spread over all of the
@@ -246,7 +246,7 @@ pub mod linear {
246246
}
247247
}
248248
249-
impl<K: Hash IterBytes Eq, V> BaseIter<(&K, &V)> for LinearMap<K, V> {
249+
impl<K:Hash + IterBytes + Eq,V> BaseIter<(&K, &V)> for LinearMap<K, V> {
250250
/// Visit all key-value pairs
251251
pure fn each(&self, blk: fn(&(&self/K, &self/V)) -> bool) {
252252
for uint::range(0, self.buckets.len()) |i| {
@@ -263,15 +263,15 @@ pub mod linear {
263263
}
264264
265265
266-
impl<K: Hash IterBytes Eq, V> Container for LinearMap<K, V> {
266+
impl<K:Hash + IterBytes + Eq,V> Container for LinearMap<K, V> {
267267
/// Return the number of elements in the map
268268
pure fn len(&self) -> uint { self.size }
269269
270270
/// Return true if the map contains no elements
271271
pure fn is_empty(&self) -> bool { self.len() == 0 }
272272
}
273273
274-
impl<K: Hash IterBytes Eq, V> Mutable for LinearMap<K, V> {
274+
impl<K:Hash + IterBytes + Eq,V> Mutable for LinearMap<K, V> {
275275
/// Clear the map, removing all key-value pairs.
276276
fn clear(&mut self) {
277277
for uint::range(0, self.buckets.len()) |idx| {
@@ -281,7 +281,7 @@ pub mod linear {
281281
}
282282
}
283283
284-
impl<K: Hash IterBytes Eq, V> Map<K, V> for LinearMap<K, V> {
284+
impl<K:Hash + IterBytes + Eq,V> Map<K, V> for LinearMap<K, V> {
285285
/// Return true if the map contains a value for the specified key
286286
pure fn contains_key(&self, k: &K) -> bool {
287287
match self.bucket_for_key(k) {
@@ -333,7 +333,7 @@ pub mod linear {
333333
}
334334
}
335335
336-
pub impl<K:Hash IterBytes Eq, V> LinearMap<K, V> {
336+
pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
337337
/// Create an empty LinearMap
338338
static fn new() -> LinearMap<K, V> {
339339
linear_map_with_capacity(INITIAL_CAPACITY)
@@ -457,7 +457,7 @@ pub mod linear {
457457
}
458458
}
459459

460-
impl<K: Hash IterBytes Eq, V: Eq> Eq for LinearMap<K, V> {
460+
impl<K:Hash + IterBytes + Eq,V:Eq> Eq for LinearMap<K, V> {
461461
pure fn eq(&self, other: &LinearMap<K, V>) -> bool {
462462
if self.len() != other.len() { return false; }
463463

@@ -478,13 +478,13 @@ pub mod linear {
478478
priv map: LinearMap<T, ()>
479479
}
480480

481-
impl<T: Hash IterBytes Eq> BaseIter<T> for LinearSet<T> {
481+
impl<T:Hash + IterBytes + Eq> BaseIter<T> for LinearSet<T> {
482482
/// Visit all values in order
483483
pure fn each(&self, f: fn(&T) -> bool) { self.map.each_key(f) }
484484
pure fn size_hint(&self) -> Option<uint> { Some(self.len()) }
485485
}
486486

487-
impl<T: Hash IterBytes Eq> Eq for LinearSet<T> {
487+
impl<T:Hash + IterBytes + Eq> Eq for LinearSet<T> {
488488
pure fn eq(&self, other: &LinearSet<T>) -> bool {
489489
self.map == other.map
490490
}
@@ -493,20 +493,20 @@ pub mod linear {
493493
}
494494
}
495495

496-
impl<T: Hash IterBytes Eq> Container for LinearSet<T> {
496+
impl<T:Hash + IterBytes + Eq> Container for LinearSet<T> {
497497
/// Return the number of elements in the set
498498
pure fn len(&self) -> uint { self.map.len() }
499499

500500
/// Return true if the set contains no elements
501501
pure fn is_empty(&self) -> bool { self.map.is_empty() }
502502
}
503503

504-
impl<T: Hash IterBytes Eq> Mutable for LinearSet<T> {
504+
impl<T:Hash + IterBytes + Eq> Mutable for LinearSet<T> {
505505
/// Clear the set, removing all values.
506506
fn clear(&mut self) { self.map.clear() }
507507
}
508508

509-
impl<T: Hash IterBytes Eq> Set<T> for LinearSet<T> {
509+
impl<T:Hash + IterBytes + Eq> Set<T> for LinearSet<T> {
510510
/// Return true if the set contains a value
511511
pure fn contains(&self, value: &T) -> bool {
512512
self.map.contains_key(value)
@@ -575,7 +575,7 @@ pub mod linear {
575575
}
576576
}
577577

578-
pub impl <T: Hash IterBytes Eq> LinearSet<T> {
578+
pub impl <T:Hash + IterBytes + Eq> LinearSet<T> {
579579
/// Create an empty LinearSet
580580
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
581581

src/libcore/io.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pub trait ReaderUtil {
169169
fn read_i8(&self) -> i8;
170170
}
171171

172-
impl<T: Reader> ReaderUtil for T {
172+
impl<T:Reader> ReaderUtil for T {
173173

174174
fn read_bytes(&self,len: uint) -> ~[u8] {
175175
let mut bytes = vec::with_capacity(len);
@@ -193,7 +193,7 @@ impl<T: Reader> ReaderUtil for T {
193193

194194
fn read_chars(&self, n: uint) -> ~[char] {
195195
// returns the (consumed offset, n_req), appends characters to &chars
196-
fn chars_from_bytes<T: Reader>(bytes: &~[u8], chars: &mut ~[char])
196+
fn chars_from_bytes<T:Reader>(bytes: &~[u8], chars: &mut ~[char])
197197
-> (uint, uint) {
198198
let mut i = 0;
199199
let bytes_len = bytes.len();
@@ -460,7 +460,7 @@ struct Wrapper<T, C> {
460460
// A forwarding impl of reader that also holds on to a resource for the
461461
// duration of its lifetime.
462462
// FIXME there really should be a better way to do this // #2004
463-
impl<R: Reader, C> Reader for Wrapper<R, C> {
463+
impl<R:Reader,C> Reader for Wrapper<R, C> {
464464
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
465465
self.base.read(bytes, len)
466466
}
@@ -589,7 +589,7 @@ pub trait Writer {
589589
fn get_type(&self) -> WriterType;
590590
}
591591
592-
impl<W: Writer, C> Writer for Wrapper<W, C> {
592+
impl<W:Writer,C> Writer for Wrapper<W, C> {
593593
fn write(&self, bs: &[const u8]) { self.base.write(bs); }
594594
fn seek(&self, off: int, style: SeekStyle) { self.base.seek(off, style); }
595595
fn tell(&self) -> uint { self.base.tell() }
@@ -890,7 +890,7 @@ pub trait WriterUtil {
890890
fn write_i8(&self, n: i8);
891891
}
892892

893-
impl<T: Writer> WriterUtil for T {
893+
impl<T:Writer> WriterUtil for T {
894894
fn write_char(&self, ch: char) {
895895
if ch as uint < 128u {
896896
self.write(&[ch as u8]);
@@ -1112,7 +1112,7 @@ pub mod fsync {
11121112
arg: Arg<t>,
11131113
}
11141114

1115-
impl<T: Copy> Drop for Res<T> {
1115+
impl<T:Copy> Drop for Res<T> {
11161116
fn finalize(&self) {
11171117
match self.arg.opt_level {
11181118
None => (),

src/libcore/iter-trait.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ impl<A> iter::ExtendedIter<A> for IMPL_T<A> {
6060

6161
}
6262

63-
impl<A: Eq> iter::EqIter<A> for IMPL_T<A> {
63+
impl<A:Eq> iter::EqIter<A> for IMPL_T<A> {
6464
#[inline(always)]
6565
pure fn contains(&self, x: &A) -> bool { iter::contains(self, x) }
6666
#[inline(always)]
6767
pure fn count(&self, x: &A) -> uint { iter::count(self, x) }
6868
}
6969

70-
impl<A: Copy> iter::CopyableIter<A> for IMPL_T<A> {
70+
impl<A:Copy> iter::CopyableIter<A> for IMPL_T<A> {
7171
#[inline(always)]
7272
pure fn filter_to_vec(&self, pred: fn(&A) -> bool) -> ~[A] {
7373
iter::filter_to_vec(self, pred)
@@ -80,7 +80,7 @@ impl<A: Copy> iter::CopyableIter<A> for IMPL_T<A> {
8080
}
8181
}
8282

83-
impl<A: Copy Ord> iter::CopyableOrderedIter<A> for IMPL_T<A> {
83+
impl<A:Copy + Ord> iter::CopyableOrderedIter<A> for IMPL_T<A> {
8484
#[inline(always)]
8585
pure fn min(&self) -> A { iter::min(self) }
8686
#[inline(always)]

0 commit comments

Comments
 (0)