Skip to content

Commit e8f36d5

Browse files
committed
librustc: Replace impl Type : Trait with impl Trait for Type. rs=implflipping
1 parent 36edd25 commit e8f36d5

File tree

583 files changed

+1115
-1115
lines changed

Some content is hidden

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

583 files changed

+1115
-1115
lines changed

src/libcore/bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn all_values(blk: fn(v: bool)) {
7474
pub pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
7575

7676
#[cfg(notest)]
77-
impl bool : cmp::Eq {
77+
impl cmp::Eq for bool {
7878
pure fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
7979
pure fn ne(&self, other: &bool) -> bool { (*self) != (*other) }
8080
}

src/libcore/char.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ pub pure fn cmp(a: char, b: char) -> int {
251251
}
252252

253253
#[cfg(notest)]
254-
impl char : Eq {
254+
impl Eq for char {
255255
pure fn eq(&self, other: &char) -> bool { (*self) == (*other) }
256256
pure fn ne(&self, other: &char) -> bool { (*self) != (*other) }
257257
}

src/libcore/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub trait Clone {
1515
fn clone(&self) -> Self;
1616
}
1717

18-
impl (): Clone {
18+
impl Clone for () {
1919
#[inline(always)]
2020
fn clone(&self) -> () { () }
2121
}

src/libcore/condition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct Guard<T, U> {
8484
cond: &Condition<T, U>
8585
}
8686

87-
impl<T, U> Guard<T, U> : Drop {
87+
impl<T, U> Drop for Guard<T, U> {
8888
fn finalize(&self) {
8989
unsafe {
9090
debug!("Guard: popping handler from TLS");

src/libcore/dvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl<A: Copy> DVec<A> {
358358
}
359359
}
360360

361-
impl<A:Copy> DVec<A>: Index<uint,A> {
361+
impl<A:Copy> Index<uint,A> for DVec<A> {
362362
#[inline(always)]
363363
pure fn index(&self, idx: uint) -> A {
364364
self.get_elt(idx)

src/libcore/hash.rs

Lines changed: 4 additions & 4 deletions
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> A: HashUtil {
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> A: Hash {
77+
impl<A: IterBytes> Hash for A {
7878
#[inline(always)]
7979
pure fn hash_keyed(k0: u64, k1: u64) -> u64 {
8080
unsafe {
@@ -187,7 +187,7 @@ fn SipState(key0: u64, key1: u64) -> SipState {
187187
}
188188

189189

190-
impl SipState : io::Writer {
190+
impl io::Writer for SipState {
191191

192192
// Methods for io::writer
193193
#[inline(always)]
@@ -295,7 +295,7 @@ impl SipState : io::Writer {
295295
}
296296
}
297297

298-
impl &SipState : Streaming {
298+
impl Streaming for &SipState {
299299

300300
#[inline(always)]
301301
fn input(buf: &[const u8]) {

src/libcore/hashmap.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ pub mod linear {
240240
}
241241
}
242242
243-
impl <K: Hash IterBytes Eq, V> LinearMap<K, V>: BaseIter<(&K, &V)> {
243+
impl<K: Hash IterBytes Eq, V> BaseIter<(&K, &V)> for LinearMap<K, V> {
244244
/// Visit all key-value pairs
245245
pure fn each(&self, blk: fn(&(&self/K, &self/V)) -> bool) {
246246
for uint::range(0, self.buckets.len()) |i| {
@@ -257,15 +257,15 @@ pub mod linear {
257257
}
258258
259259
260-
impl <K: Hash IterBytes Eq, V> LinearMap<K, V>: Container {
260+
impl<K: Hash IterBytes Eq, V> Container for LinearMap<K, V> {
261261
/// Return the number of elements in the map
262262
pure fn len(&self) -> uint { self.size }
263263
264264
/// Return true if the map contains no elements
265265
pure fn is_empty(&self) -> bool { self.len() == 0 }
266266
}
267267
268-
impl <K: Hash IterBytes Eq, V> LinearMap<K, V>: Mutable {
268+
impl<K: Hash IterBytes Eq, V> Mutable for LinearMap<K, V> {
269269
/// Clear the map, removing all key-value pairs.
270270
fn clear(&mut self) {
271271
for uint::range(0, self.buckets.len()) |idx| {
@@ -275,7 +275,7 @@ pub mod linear {
275275
}
276276
}
277277
278-
impl <K: Hash IterBytes Eq, V> LinearMap<K, V>: Map<K, V> {
278+
impl<K: Hash IterBytes Eq, V> Map<K, V> for LinearMap<K, V> {
279279
/// Return true if the map contains a value for the specified key
280280
pure fn contains_key(&self, k: &K) -> bool {
281281
match self.bucket_for_key(k) {
@@ -443,7 +443,7 @@ pub mod linear {
443443
}
444444
}
445445

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

@@ -464,13 +464,13 @@ pub mod linear {
464464
priv map: LinearMap<T, ()>
465465
}
466466

467-
impl <T: Hash IterBytes Eq> LinearSet<T>: BaseIter<T> {
467+
impl<T: Hash IterBytes Eq> BaseIter<T> for LinearSet<T> {
468468
/// Visit all values in order
469469
pure fn each(&self, f: fn(&T) -> bool) { self.map.each_key(f) }
470470
pure fn size_hint(&self) -> Option<uint> { Some(self.len()) }
471471
}
472472

473-
impl <T: Hash IterBytes Eq> LinearSet<T>: Eq {
473+
impl<T: Hash IterBytes Eq> Eq for LinearSet<T> {
474474
pure fn eq(&self, other: &LinearSet<T>) -> bool {
475475
self.map == other.map
476476
}
@@ -479,20 +479,20 @@ pub mod linear {
479479
}
480480
}
481481

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

486486
/// Return true if the set contains no elements
487487
pure fn is_empty(&self) -> bool { self.map.is_empty() }
488488
}
489489

490-
impl <T: Hash IterBytes Eq> LinearSet<T>: Mutable {
490+
impl<T: Hash IterBytes Eq> Mutable for LinearSet<T> {
491491
/// Clear the set, removing all values.
492492
fn clear(&mut self) { self.map.clear() }
493493
}
494494

495-
impl <T: Hash IterBytes Eq> LinearSet<T>: Set<T> {
495+
impl<T: Hash IterBytes Eq> Set<T> for LinearSet<T> {
496496
/// Return true if the set contains a value
497497
pure fn contains(&self, value: &T) -> bool {
498498
self.map.contains_key(value)

src/libcore/io.rs

Lines changed: 10 additions & 10 deletions
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> T : ReaderUtil {
172+
impl<T: Reader> ReaderUtil for T {
173173

174174
fn read_bytes(&self,len: uint) -> ~[u8] {
175175
let mut bytes = vec::with_capacity(len);
@@ -415,7 +415,7 @@ fn convert_whence(whence: SeekStyle) -> i32 {
415415
};
416416
}
417417

418-
impl *libc::FILE: Reader {
418+
impl Reader for *libc::FILE {
419419
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
420420
unsafe {
421421
do vec::as_mut_buf(bytes) |buf_p, buf_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> Wrapper<R, C>: Reader {
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
}
@@ -527,7 +527,7 @@ pub struct BytesReader {
527527
mut pos: uint
528528
}
529529
530-
impl BytesReader: Reader {
530+
impl Reader for BytesReader {
531531
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
532532
let count = uint::min(len, self.bytes.len() - self.pos);
533533
@@ -589,15 +589,15 @@ pub trait Writer {
589589
fn get_type(&self) -> WriterType;
590590
}
591591
592-
impl<W: Writer, C> Wrapper<W, C>: Writer {
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() }
596596
fn flush(&self) -> int { self.base.flush() }
597597
fn get_type(&self) -> WriterType { File }
598598
}
599599
600-
impl *libc::FILE: Writer {
600+
impl Writer for *libc::FILE {
601601
fn write(&self, v: &[const u8]) {
602602
unsafe {
603603
do vec::as_const_buf(v) |vbuf, len| {
@@ -647,7 +647,7 @@ pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> Writer {
647647
}
648648
}
649649

650-
impl fd_t: Writer {
650+
impl Writer for fd_t {
651651
fn write(&self, v: &[const u8]) {
652652
unsafe {
653653
let mut count = 0u;
@@ -890,7 +890,7 @@ pub trait WriterUtil {
890890
fn write_i8(&self, n: i8);
891891
}
892892

893-
impl<T: Writer> T : WriterUtil {
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]);
@@ -996,7 +996,7 @@ pub struct BytesWriter {
996996
mut pos: uint,
997997
}
998998
999-
impl BytesWriter: Writer {
999+
impl Writer for BytesWriter {
10001000
fn write(&self, v: &[const u8]) {
10011001
do self.bytes.swap |bytes| {
10021002
let mut bytes = move bytes;
@@ -1112,7 +1112,7 @@ pub mod fsync {
11121112
arg: Arg<t>,
11131113
}
11141114

1115-
impl<T: Copy> Res<T>: Drop {
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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ use option::Option;
2020

2121
use self::inst::{IMPL_T, EACH, SIZE_HINT};
2222

23-
impl<A> IMPL_T<A>: iter::BaseIter<A> {
23+
impl<A> iter::BaseIter<A> for IMPL_T<A> {
2424
#[inline(always)]
2525
pure fn each(&self, blk: fn(v: &A) -> bool) { EACH(self, blk) }
2626
#[inline(always)]
2727
pure fn size_hint(&self) -> Option<uint> { SIZE_HINT(self) }
2828
}
2929

30-
impl<A> IMPL_T<A>: iter::ExtendedIter<A> {
30+
impl<A> iter::ExtendedIter<A> for IMPL_T<A> {
3131
#[inline(always)]
3232
pure fn eachi(&self, blk: fn(uint, v: &A) -> bool) {
3333
iter::eachi(self, blk)
@@ -60,14 +60,14 @@ impl<A> IMPL_T<A>: iter::ExtendedIter<A> {
6060

6161
}
6262

63-
impl<A: Eq> IMPL_T<A>: iter::EqIter<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> IMPL_T<A>: iter::CopyableIter<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> IMPL_T<A>: iter::CopyableIter<A> {
8080
}
8181
}
8282

83-
impl<A: Copy Ord> IMPL_T<A>: iter::CopyableOrderedIter<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)]

src/libcore/managed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ pub pure fn mut_ptr_eq<T>(a: @mut T, b: @mut T) -> bool {
4646
}
4747

4848
#[cfg(notest)]
49-
impl<T:Eq> @const T : Eq {
49+
impl<T:Eq> Eq for @const T {
5050
#[inline(always)]
5151
pure fn eq(&self, other: &@const T) -> bool { *(*self) == *(*other) }
5252
#[inline(always)]
5353
pure fn ne(&self, other: &@const T) -> bool { *(*self) != *(*other) }
5454
}
5555

5656
#[cfg(notest)]
57-
impl<T:Ord> @const T : Ord {
57+
impl<T:Ord> Ord for @const T {
5858
#[inline(always)]
5959
pure fn lt(&self, other: &@const T) -> bool { *(*self) < *(*other) }
6060
#[inline(always)]

src/libcore/nil.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Functions for the unit type.
1717
use cmp::{Eq, Ord};
1818

1919
#[cfg(notest)]
20-
impl () : Eq {
20+
impl Eq for () {
2121
#[inline(always)]
2222
pure fn eq(&self, _other: &()) -> bool { true }
2323
#[inline(always)]
2424
pure fn ne(&self, _other: &()) -> bool { false }
2525
}
2626

2727
#[cfg(notest)]
28-
impl () : Ord {
28+
impl Ord for () {
2929
#[inline(always)]
3030
pure fn lt(&self, _other: &()) -> bool { false }
3131
#[inline(always)]

0 commit comments

Comments
 (0)