From bf2a225c0b6f90f61bcaf4a6f33d9eaf424795b6 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 20 Feb 2013 17:07:17 -0800 Subject: [PATCH] librustc: Separate most trait bounds with '+'. rs=plussing --- src/libcore/at_vec.rs | 6 +- src/libcore/cmp.rs | 16 +- src/libcore/dlist.rs | 4 +- src/libcore/dvec.rs | 2 +- src/libcore/either.rs | 2 +- src/libcore/hash.rs | 4 +- src/libcore/hashmap.rs | 30 ++-- src/libcore/io.rs | 12 +- src/libcore/iter-trait.rs | 6 +- src/libcore/iter.rs | 14 +- src/libcore/num/num.rs | 2 +- src/libcore/option.rs | 10 +- src/libcore/pipes.rs | 80 +++++----- src/libcore/private.rs | 20 +-- src/libcore/private/global.rs | 12 +- src/libcore/rand.rs | 6 +- src/libcore/reflect.rs | 6 +- src/libcore/result.rs | 8 +- src/libcore/task/local_data.rs | 8 +- src/libcore/task/local_data_priv.rs | 16 +- src/libcore/task/mod.rs | 4 +- src/libcore/to_bytes.rs | 22 +-- src/libcore/to_str.rs | 10 +- src/libcore/tuple.rs | 14 +- src/libcore/util.rs | 2 +- src/libcore/vec.rs | 138 +++++++++--------- src/libfuzzer/cycles.rs | 2 +- src/libfuzzer/ivec_fuzz.rs | 16 +- src/libfuzzer/rand_util.rs | 8 +- src/librustc/driver/session.rs | 2 +- src/librustc/front/core_inject.rs | 2 +- src/librustc/front/test.rs | 2 +- src/librustc/metadata/encoder.rs | 2 +- src/librustc/metadata/filesearch.rs | 2 +- src/librustc/middle/astencode.rs | 8 +- src/librustc/middle/borrowck/mod.rs | 2 +- src/librustc/middle/lint.rs | 2 +- src/librustc/middle/mem_categorization.rs | 18 +-- src/librustc/middle/trans/debuginfo.rs | 4 +- src/librustc/middle/ty.rs | 4 +- src/librustc/middle/typeck/astconv.rs | 18 +-- src/librustc/middle/typeck/check/mod.rs | 2 +- src/librustc/middle/typeck/collect.rs | 2 +- src/librustc/middle/typeck/infer/combine.rs | 2 +- src/librustc/middle/typeck/infer/lattice.rs | 8 +- src/librustc/middle/typeck/infer/mod.rs | 8 +- src/librustc/middle/typeck/infer/to_str.rs | 2 +- src/librustc/middle/typeck/infer/unify.rs | 6 +- src/librustc/middle/typeck/mod.rs | 2 +- src/librustc/middle/typeck/rscope.rs | 9 +- src/librustdoc/fold.rs | 8 +- src/librustdoc/util.rs | 2 +- src/libstd/arc.rs | 36 ++--- src/libstd/c_vec.rs | 4 +- src/libstd/comm.rs | 12 +- src/libstd/deque.rs | 2 +- src/libstd/flatpipes.rs | 48 +++--- src/libstd/fun_treemap.rs | 4 +- src/libstd/json.rs | 16 +- src/libstd/list.rs | 18 +-- src/libstd/oldmap.rs | 28 ++-- src/libstd/oldsmallintmap.rs | 14 +- src/libstd/par.rs | 10 +- src/libstd/priority_queue.rs | 8 +- src/libstd/semver.rs | 2 +- src/libstd/serialize.rs | 106 +++++++------- src/libstd/smallintmap.rs | 2 +- src/libstd/sort.rs | 32 ++-- src/libstd/sync.rs | 6 +- src/libstd/timer.rs | 4 +- src/libstd/treemap.rs | 66 ++++----- src/libstd/workcache.rs | 4 +- src/libsyntax/ast.rs | 6 +- src/libsyntax/codemap.rs | 4 +- src/libsyntax/diagnostic.rs | 2 +- src/libsyntax/ext/auto_encode.rs | 6 +- src/libsyntax/ext/pipes/ast_builder.rs | 2 +- src/libsyntax/parse/common.rs | 14 +- src/libsyntax/print/pprust.rs | 2 +- src/libsyntax/util/interner.rs | 2 +- src/libsyntax/util/testing.rs | 4 +- src/test/auxiliary/cci_capture_clause.rs | 2 +- src/test/auxiliary/cci_nested_lib.rs | 8 +- src/test/auxiliary/issue-2526.rs | 4 +- src/test/auxiliary/issue-2631-a.rs | 2 +- src/test/auxiliary/issue4516_ty_param_lib.rs | 2 +- src/test/auxiliary/static-methods-crate.rs | 2 +- .../trait_inheritance_auto_xc_aux.rs | 2 +- src/test/bench/core-set.rs | 4 +- src/test/bench/pingpong.rs | 2 +- src/test/bench/shootout-k-nucleotide-pipes.rs | 6 +- src/test/compile-fail/ambig_impl_bounds.rs | 2 +- src/test/compile-fail/issue-2611-3.rs | 4 +- src/test/compile-fail/issue-2611-4.rs | 4 +- src/test/compile-fail/issue-2611-5.rs | 4 +- src/test/compile-fail/issue-2766-a.rs | 6 +- .../compile-fail/issue-3177-mutable-struct.rs | 2 +- .../compile-fail/kindck-owned-trait-scoped.rs | 2 +- src/test/compile-fail/kindck-owned-trait.rs | 4 +- src/test/compile-fail/kindck-owned.rs | 4 +- .../compile-fail/liveness-use-after-send.rs | 2 +- src/test/compile-fail/non-const.rs | 2 +- src/test/compile-fail/obsolete-syntax.rs | 8 +- .../regions-escape-via-trait-or-not.rs | 2 +- src/test/compile-fail/unique-unique-kind.rs | 2 +- src/test/compile-fail/vec-concat-bug.rs | 2 +- .../compile-fail/vtable-res-trait-param.rs | 6 +- src/test/run-fail/bug-811.rs | 2 +- src/test/run-pass/alignment-gep-tup-like-1.rs | 2 +- src/test/run-pass/alignment-gep-tup-like-2.rs | 2 +- src/test/run-pass/auto-encode.rs | 2 +- src/test/run-pass/auto-instantiate.rs | 2 +- src/test/run-pass/autobind.rs | 2 +- ...autoderef-method-on-trait-monomorphized.rs | 2 +- .../autoref-intermediate-types-issue-3585.rs | 2 +- src/test/run-pass/borrowed-ptr-pattern.rs | 2 +- src/test/run-pass/box-unbox.rs | 2 +- .../class-cast-to-trait-cross-crate-2.rs | 2 +- .../class-cast-to-trait-cross-crate.rs | 2 +- .../class-cast-to-trait-multiple-types.rs | 2 +- src/test/run-pass/class-implement-traits.rs | 2 +- .../class-implements-multiple-traits.rs | 6 +- src/test/run-pass/class-separate-impl.rs | 2 +- .../run-pass/class-trait-bounded-param.rs | 2 +- .../close-over-big-then-small-data.rs | 2 +- src/test/run-pass/const-bound.rs | 2 +- .../run-pass/explicit-self-objects-ext-1.rs | 2 +- .../run-pass/explicit-self-objects-ext-2.rs | 2 +- .../run-pass/explicit-self-objects-ext-3.rs | 2 +- .../run-pass/explicit-self-objects-ext-4.rs | 2 +- src/test/run-pass/expr-alt-generic-box2.rs | 2 +- src/test/run-pass/expr-alt-generic-unique1.rs | 2 +- src/test/run-pass/expr-alt-generic-unique2.rs | 2 +- src/test/run-pass/expr-alt-generic.rs | 2 +- src/test/run-pass/expr-block-generic-box2.rs | 2 +- .../run-pass/expr-block-generic-unique1.rs | 2 +- .../run-pass/expr-block-generic-unique2.rs | 2 +- src/test/run-pass/expr-block-generic.rs | 2 +- src/test/run-pass/expr-fn.rs | 2 +- src/test/run-pass/expr-if-generic-box2.rs | 2 +- src/test/run-pass/expr-if-generic.rs | 2 +- src/test/run-pass/fixed-point-bind-unique.rs | 4 +- src/test/run-pass/fn-bare-spawn.rs | 2 +- src/test/run-pass/generic-alias-box.rs | 2 +- src/test/run-pass/generic-alias-unique.rs | 2 +- src/test/run-pass/generic-box.rs | 2 +- src/test/run-pass/generic-derived-type.rs | 4 +- src/test/run-pass/generic-drop-glue.rs | 2 +- src/test/run-pass/generic-exterior-box.rs | 2 +- src/test/run-pass/generic-exterior-unique.rs | 2 +- src/test/run-pass/generic-fn-infer.rs | 2 +- src/test/run-pass/generic-fn-unique.rs | 2 +- src/test/run-pass/generic-fn.rs | 2 +- src/test/run-pass/generic-tup.rs | 2 +- src/test/run-pass/generic-unique.rs | 2 +- src/test/run-pass/issue-2284.rs | 2 +- src/test/run-pass/issue-2288.rs | 8 +- src/test/run-pass/issue-2311-2.rs | 6 +- src/test/run-pass/issue-2445-b.rs | 6 +- src/test/run-pass/issue-2445.rs | 6 +- src/test/run-pass/issue-2718.rs | 24 +-- src/test/run-pass/issue-2734.rs | 2 +- src/test/run-pass/issue-2735.rs | 2 +- src/test/run-pass/issue-2834.rs | 2 +- src/test/run-pass/issue-3305.rs | 2 +- src/test/run-pass/issue-333.rs | 4 +- src/test/run-pass/issue-3480.rs | 6 +- src/test/run-pass/issue-4016.rs | 2 +- src/test/run-pass/ivec-add.rs | 2 +- src/test/run-pass/monad.rs | 4 +- ...nomorphized-callees-with-ty-params-3314.rs | 8 +- src/test/run-pass/newtype-polymorphic.rs | 4 +- src/test/run-pass/non-boolean-pure-fns.rs | 8 +- src/test/run-pass/pipe-bank-proto.rs | 2 +- src/test/run-pass/reflect-visit-data.rs | 4 +- src/test/run-pass/resource-generic.rs | 4 +- src/test/run-pass/ret-break-cont-in-block.rs | 2 +- src/test/run-pass/ret-none.rs | 2 +- src/test/run-pass/send-type-inference.rs | 2 +- src/test/run-pass/sendfn-generic-fn.rs | 4 +- src/test/run-pass/static-impl.rs | 4 +- ...tic-method-in-trait-with-tps-intracrate.rs | 4 +- src/test/run-pass/static-method-test.rs | 4 +- src/test/run-pass/trait-bounds.rs | 2 +- src/test/run-pass/trait-cast.rs | 4 +- .../run-pass/trait-default-method-bound.rs | 2 +- src/test/run-pass/trait-generic.rs | 6 +- .../run-pass/trait-inheritance-auto-xc-2.rs | 4 +- .../run-pass/trait-inheritance-auto-xc.rs | 2 +- src/test/run-pass/trait-inheritance-auto.rs | 4 +- ...trait-inheritance-call-bound-inherited2.rs | 2 +- .../run-pass/trait-inheritance-diamond.rs | 2 +- .../trait-inheritance-multiple-inheritors.rs | 2 +- .../trait-inheritance-multiple-params.rs | 2 +- .../trait-inheritance-overloading-xc-exe.rs | 2 +- .../run-pass/trait-inheritance-overloading.rs | 2 +- .../run-pass/trait-inheritance-visibility.rs | 4 +- src/test/run-pass/trait-inheritance2.rs | 2 +- src/test/run-pass/trait-to-str.rs | 6 +- src/test/run-pass/type-param-constraints.rs | 4 +- src/test/run-pass/uniq-cc-generic.rs | 2 +- src/test/run-pass/unique-assign-generic.rs | 2 +- src/test/run-pass/unique-generic-assign.rs | 2 +- src/test/run-pass/unique-kinds.rs | 12 +- 204 files changed, 729 insertions(+), 726 deletions(-) diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 565fe11d3f4a8..1880feaf4967e 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -101,7 +101,7 @@ pub pure fn build_sized_opt(size: Option, // Appending #[inline(always)] -pub pure fn append(lhs: @[T], rhs: &[const T]) -> @[T] { +pub pure fn append(lhs: @[T], rhs: &[const T]) -> @[T] { do build_sized(lhs.len() + rhs.len()) |push| { for vec::each(lhs) |x| { push(*x); } for uint::range(0, rhs.len()) |i| { push(rhs[i]); } @@ -137,7 +137,7 @@ pub pure fn from_fn(n_elts: uint, op: iter::InitOp) -> @[T] { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value `t`. */ -pub pure fn from_elem(n_elts: uint, t: T) -> @[T] { +pub pure fn from_elem(n_elts: uint, t: T) -> @[T] { do build_sized(n_elts) |push| { let mut i: uint = 0u; while i < n_elts { push(copy t); i += 1u; } @@ -173,7 +173,7 @@ pub mod traits { use kinds::Copy; use ops::Add; - pub impl Add<&[const T],@[T]> for @[T] { + pub impl Add<&[const T],@[T]> for @[T] { #[inline(always)] pure fn add(&self, rhs: & &self/[const T]) -> @[T] { append(*self, (*rhs)) diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 7cd4d4c9bc3b2..fd99235bd270c 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -56,41 +56,41 @@ pub trait Ord { } #[inline(always)] -pub pure fn lt(v1: &T, v2: &T) -> bool { +pub pure fn lt(v1: &T, v2: &T) -> bool { (*v1).lt(v2) } #[inline(always)] -pub pure fn le(v1: &T, v2: &T) -> bool { +pub pure fn le(v1: &T, v2: &T) -> bool { (*v1).le(v2) } #[inline(always)] -pub pure fn eq(v1: &T, v2: &T) -> bool { +pub pure fn eq(v1: &T, v2: &T) -> bool { (*v1).eq(v2) } #[inline(always)] -pub pure fn ne(v1: &T, v2: &T) -> bool { +pub pure fn ne(v1: &T, v2: &T) -> bool { (*v1).ne(v2) } #[inline(always)] -pub pure fn ge(v1: &T, v2: &T) -> bool { +pub pure fn ge(v1: &T, v2: &T) -> bool { (*v1).ge(v2) } #[inline(always)] -pub pure fn gt(v1: &T, v2: &T) -> bool { +pub pure fn gt(v1: &T, v2: &T) -> bool { (*v1).gt(v2) } #[inline(always)] -pub pure fn min(v1: T, v2: T) -> T { +pub pure fn min(v1: T, v2: T) -> T { if v1 < v2 { v1 } else { v2 } } #[inline(always)] -pub pure fn max(v1: T, v2: T) -> T { +pub pure fn max(v1: T, v2: T) -> T { if v1 > v2 { v1 } else { v2 } } diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index 09de94f1aaf7d..3580736488926 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -106,7 +106,7 @@ pub pure fn from_elem(data: T) -> @mut DList { list } -pub fn from_vec(vec: &[T]) -> @mut DList { +pub fn from_vec(vec: &[T]) -> @mut DList { do vec::foldl(DList(), vec) |list,data| { list.push(*data); // Iterating left-to-right -- add newly to the tail. list @@ -457,7 +457,7 @@ impl DList { } } -impl DList { +impl DList { /// Remove data from the head of the list. O(1). fn pop(@mut self) -> Option { self.pop_n().map(|nobe| nobe.data) diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 03a921d7ea504..7651b737bf34e 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -227,7 +227,7 @@ impl DVec { } } -impl DVec { +impl DVec { /** * Append all elements of a vector to the end of the list * diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 72aecdd82954f..93b28233acdd8 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -41,7 +41,7 @@ pub fn either(f_left: fn(&T) -> V, } } -pub fn lefts(eithers: &[Either]) -> ~[T] { +pub fn lefts(eithers: &[Either]) -> ~[T] { //! Extracts from a vector of either all the left values do vec::build_sized(eithers.len()) |push| { diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs index 40a9de0cea349..7c1448c88eef7 100644 --- a/src/libcore/hash.rs +++ b/src/libcore/hash.rs @@ -59,7 +59,7 @@ pub trait HashUtil { pure fn hash() -> u64; } -impl HashUtil for A { +impl HashUtil for A { #[inline(always)] pure fn hash() -> u64 { self.hash_keyed(0,0) } } @@ -74,7 +74,7 @@ pub trait Streaming { fn reset(); } -impl Hash for A { +impl Hash for A { #[inline(always)] pure fn hash_keyed(k0: u64, k1: u64) -> u64 { unsafe { diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs index 9cc7c2b760c55..07c7780898f96 100644 --- a/src/libcore/hashmap.rs +++ b/src/libcore/hashmap.rs @@ -56,14 +56,14 @@ pub mod linear { ((capacity as float) * 3. / 4.) as uint } - pub fn linear_map_with_capacity( + pub fn linear_map_with_capacity( initial_capacity: uint) -> LinearMap { let r = rand::task_rng(); linear_map_with_capacity_and_keys(r.gen_u64(), r.gen_u64(), initial_capacity) } - pure fn linear_map_with_capacity_and_keys( + pure fn linear_map_with_capacity_and_keys( k0: u64, k1: u64, initial_capacity: uint) -> LinearMap { LinearMap { @@ -74,7 +74,7 @@ pub mod linear { } } - priv impl LinearMap { + priv impl LinearMap { #[inline(always)] pure fn to_bucket(&self, h: uint) -> uint { // A good hash function with entropy spread over all of the @@ -246,7 +246,7 @@ pub mod linear { } } - impl BaseIter<(&K, &V)> for LinearMap { + impl BaseIter<(&K, &V)> for LinearMap { /// Visit all key-value pairs pure fn each(&self, blk: fn(&(&self/K, &self/V)) -> bool) { for uint::range(0, self.buckets.len()) |i| { @@ -263,7 +263,7 @@ pub mod linear { } - impl Container for LinearMap { + impl Container for LinearMap { /// Return the number of elements in the map pure fn len(&self) -> uint { self.size } @@ -271,7 +271,7 @@ pub mod linear { pure fn is_empty(&self) -> bool { self.len() == 0 } } - impl Mutable for LinearMap { + impl Mutable for LinearMap { /// Clear the map, removing all key-value pairs. fn clear(&mut self) { for uint::range(0, self.buckets.len()) |idx| { @@ -281,7 +281,7 @@ pub mod linear { } } - impl Map for LinearMap { + impl Map for LinearMap { /// Return true if the map contains a value for the specified key pure fn contains_key(&self, k: &K) -> bool { match self.bucket_for_key(k) { @@ -333,7 +333,7 @@ pub mod linear { } } - pub impl LinearMap { + pub impl LinearMap { /// Create an empty LinearMap static fn new() -> LinearMap { linear_map_with_capacity(INITIAL_CAPACITY) @@ -457,7 +457,7 @@ pub mod linear { } } - impl Eq for LinearMap { + impl Eq for LinearMap { pure fn eq(&self, other: &LinearMap) -> bool { if self.len() != other.len() { return false; } @@ -478,13 +478,13 @@ pub mod linear { priv map: LinearMap } - impl BaseIter for LinearSet { + impl BaseIter for LinearSet { /// Visit all values in order pure fn each(&self, f: fn(&T) -> bool) { self.map.each_key(f) } pure fn size_hint(&self) -> Option { Some(self.len()) } } - impl Eq for LinearSet { + impl Eq for LinearSet { pure fn eq(&self, other: &LinearSet) -> bool { self.map == other.map } @@ -493,7 +493,7 @@ pub mod linear { } } - impl Container for LinearSet { + impl Container for LinearSet { /// Return the number of elements in the set pure fn len(&self) -> uint { self.map.len() } @@ -501,12 +501,12 @@ pub mod linear { pure fn is_empty(&self) -> bool { self.map.is_empty() } } - impl Mutable for LinearSet { + impl Mutable for LinearSet { /// Clear the set, removing all values. fn clear(&mut self) { self.map.clear() } } - impl Set for LinearSet { + impl Set for LinearSet { /// Return true if the set contains a value pure fn contains(&self, value: &T) -> bool { self.map.contains_key(value) @@ -575,7 +575,7 @@ pub mod linear { } } - pub impl LinearSet { + pub impl LinearSet { /// Create an empty LinearSet static fn new() -> LinearSet { LinearSet{map: LinearMap::new()} } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 6739c5b852e1d..421eb94a29128 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -169,7 +169,7 @@ pub trait ReaderUtil { fn read_i8(&self) -> i8; } -impl ReaderUtil for T { +impl ReaderUtil for T { fn read_bytes(&self,len: uint) -> ~[u8] { let mut bytes = vec::with_capacity(len); @@ -193,7 +193,7 @@ impl ReaderUtil for T { fn read_chars(&self, n: uint) -> ~[char] { // returns the (consumed offset, n_req), appends characters to &chars - fn chars_from_bytes(bytes: &~[u8], chars: &mut ~[char]) + fn chars_from_bytes(bytes: &~[u8], chars: &mut ~[char]) -> (uint, uint) { let mut i = 0; let bytes_len = bytes.len(); @@ -460,7 +460,7 @@ struct Wrapper { // A forwarding impl of reader that also holds on to a resource for the // duration of its lifetime. // FIXME there really should be a better way to do this // #2004 -impl Reader for Wrapper { +impl Reader for Wrapper { fn read(&self, bytes: &mut [u8], len: uint) -> uint { self.base.read(bytes, len) } @@ -589,7 +589,7 @@ pub trait Writer { fn get_type(&self) -> WriterType; } -impl Writer for Wrapper { +impl Writer for Wrapper { fn write(&self, bs: &[const u8]) { self.base.write(bs); } fn seek(&self, off: int, style: SeekStyle) { self.base.seek(off, style); } fn tell(&self) -> uint { self.base.tell() } @@ -890,7 +890,7 @@ pub trait WriterUtil { fn write_i8(&self, n: i8); } -impl WriterUtil for T { +impl WriterUtil for T { fn write_char(&self, ch: char) { if ch as uint < 128u { self.write(&[ch as u8]); @@ -1112,7 +1112,7 @@ pub mod fsync { arg: Arg, } - impl Drop for Res { + impl Drop for Res { fn finalize(&self) { match self.arg.opt_level { None => (), diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index 9a8f01baed1eb..7c4a99133bbdb 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -60,14 +60,14 @@ impl iter::ExtendedIter for IMPL_T { } -impl iter::EqIter for IMPL_T { +impl iter::EqIter for IMPL_T { #[inline(always)] pure fn contains(&self, x: &A) -> bool { iter::contains(self, x) } #[inline(always)] pure fn count(&self, x: &A) -> uint { iter::count(self, x) } } -impl iter::CopyableIter for IMPL_T { +impl iter::CopyableIter for IMPL_T { #[inline(always)] pure fn filter_to_vec(&self, pred: fn(&A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) @@ -80,7 +80,7 @@ impl iter::CopyableIter for IMPL_T { } } -impl iter::CopyableOrderedIter for IMPL_T { +impl iter::CopyableOrderedIter for IMPL_T { #[inline(always)] pure fn min(&self) -> A { iter::min(self) } #[inline(always)] diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 25cdb11456a06..e48edc9c1735b 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -57,7 +57,7 @@ pub trait CopyableIter { pure fn find(&self, p: fn(&A) -> bool) -> Option; } -pub trait CopyableOrderedIter { +pub trait CopyableOrderedIter { pure fn min(&self) -> A; pure fn max(&self) -> A; } @@ -211,7 +211,7 @@ pub pure fn repeat(times: uint, blk: fn() -> bool) { } #[inline(always)] -pub pure fn min>(self: &IA) -> A { +pub pure fn min>(self: &IA) -> A { match do foldl::,IA>(self, None) |a, b| { match a { &Some(ref a_) if *a_ < *b => { @@ -226,7 +226,7 @@ pub pure fn min>(self: &IA) -> A { } #[inline(always)] -pub pure fn max>(self: &IA) -> A { +pub pure fn max>(self: &IA) -> A { match do foldl::,IA>(self, None) |a, b| { match a { &Some(ref a_) if *a_ > *b => { @@ -241,7 +241,7 @@ pub pure fn max>(self: &IA) -> A { } #[inline(always)] -pub pure fn find>(self: &IA, +pub pure fn find>(self: &IA, f: fn(&A) -> bool) -> Option { for self.each |i| { if f(i) { return Some(*i) } @@ -323,7 +323,7 @@ pub pure fn from_fn>(n_elts: uint, * to the value `t`. */ #[inline(always)] -pub pure fn from_elem>(n_elts: uint, +pub pure fn from_elem>(n_elts: uint, t: T) -> BT { do Buildable::build_sized(n_elts) |push| { let mut i: uint = 0; @@ -333,7 +333,7 @@ pub pure fn from_elem>(n_elts: uint, /// Appending two generic sequences #[inline(always)] -pub pure fn append,BT: Buildable>( +pub pure fn append,BT:Buildable>( lhs: &IT, rhs: &IT) -> BT { let size_opt = lhs.size_hint().chain_ref( |sz1| rhs.size_hint().map(|sz2| *sz1+*sz2)); @@ -346,7 +346,7 @@ pub pure fn append,BT: Buildable>( /// Copies a generic sequence, possibly converting it to a different /// type of sequence. #[inline(always)] -pub pure fn copy_seq,BT: Buildable>( +pub pure fn copy_seq,BT:Buildable>( v: &IT) -> BT { do build_sized_opt(v.size_hint()) |push| { for v.each |x| { push(*x); } diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs index e720c2fa108ae..7038ba07c0dea 100644 --- a/src/libcore/num/num.rs +++ b/src/libcore/num/num.rs @@ -62,7 +62,7 @@ pub enum RoundMode { * ~~~ */ #[inline(always)] -pub pure fn cast(n: T) -> U { +pub pure fn cast(n: T) -> U { NumCast::from(n) } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 13d4ec6e10df6..e27b7086bc45b 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -85,7 +85,7 @@ pub impl Ord for Option { } #[inline(always)] -pub pure fn get(opt: Option) -> T { +pub pure fn get(opt: Option) -> T { /*! Gets the value out of an option @@ -207,14 +207,14 @@ pub pure fn is_some(opt: &Option) -> bool { } #[inline(always)] -pub pure fn get_or_zero(opt: Option) -> T { +pub pure fn get_or_zero(opt: Option) -> T { //! Returns the contained value or zero (for this type) match opt { Some(copy x) => x, None => Zero::zero() } } #[inline(always)] -pub pure fn get_or_default(opt: Option, def: T) -> T { +pub pure fn get_or_default(opt: Option, def: T) -> T { //! Returns the contained value or a default match opt { Some(copy x) => x, None => def } @@ -393,7 +393,7 @@ impl Option { pure fn expect(self, reason: &str) -> T { expect(self, reason) } } -impl Option { +impl Option { /** Gets the value out of an option @@ -421,7 +421,7 @@ impl Option { } } -impl Option { +impl Option { #[inline(always)] pure fn get_or_zero(self) -> T { get_or_zero(self) } } diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index f0108fe85b757..b3e32fc6b6c06 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -189,7 +189,7 @@ impl PacketHeader { reinterpret_cast(&self.buffer) } - fn set_buffer(b: ~Buffer) { + fn set_buffer(b: ~Buffer) { unsafe { self.buffer = reinterpret_cast(&b); } @@ -207,14 +207,14 @@ pub trait HasBuffer { fn set_buffer(b: *libc::c_void); } -impl HasBuffer for Packet { +impl HasBuffer for Packet { fn set_buffer(b: *libc::c_void) { self.header.buffer = b; } } #[doc(hidden)] -pub fn mk_packet() -> Packet { +pub fn mk_packet() -> Packet { Packet { header: PacketHeader(), payload: None, @@ -246,7 +246,7 @@ pub fn packet() -> *Packet { } #[doc(hidden)] -pub fn entangle_buffer( +pub fn entangle_buffer( buffer: ~Buffer, init: fn(*libc::c_void, x: &T) -> *Packet) -> (SendPacketBuffered, RecvPacketBuffered) @@ -432,7 +432,7 @@ pub fn send(p: SendPacketBuffered, payload: T) -> bool { Fails if the sender closes the connection. */ -pub fn recv( +pub fn recv( p: RecvPacketBuffered) -> T { try_recv(p).expect("connection closed") } @@ -443,7 +443,7 @@ Returns `None` if the sender has closed the connection without sending a message, or `Some(T)` if a message was received. */ -pub fn try_recv(p: RecvPacketBuffered) +pub fn try_recv(p: RecvPacketBuffered) -> Option { let p_ = p.unwrap(); @@ -553,7 +553,7 @@ pub fn try_recv(p: RecvPacketBuffered) } /// Returns true if messages are available. -pub pure fn peek(p: &RecvPacketBuffered) -> bool { +pub pure fn peek(p: &RecvPacketBuffered) -> bool { match unsafe {(*p.header()).state} { Empty | Terminated => false, Blocked => fail!(~"peeking on blocked packet"), @@ -561,14 +561,14 @@ pub pure fn peek(p: &RecvPacketBuffered) -> bool { } } -impl Peekable for RecvPacketBuffered { +impl Peekable for RecvPacketBuffered { pure fn peek() -> bool { peek(&self) } } #[doc(hidden)] -fn sender_terminate(p: *Packet) { +fn sender_terminate(p: *Packet) { let p = unsafe { &*p }; match swap_state_rel(&mut p.header.state, Terminated) { Empty => { @@ -599,7 +599,7 @@ fn sender_terminate(p: *Packet) { } #[doc(hidden)] -fn receiver_terminate(p: *Packet) { +fn receiver_terminate(p: *Packet) { let p = unsafe { &*p }; match swap_state_rel(&mut p.header.state, Terminated) { Empty => { @@ -632,7 +632,7 @@ that vector. The index points to an endpoint that has either been closed by the sender or has a message waiting to be received. */ -fn wait_many(pkts: &[T]) -> uint { +fn wait_many(pkts: &[T]) -> uint { let this = unsafe { rustrt::rust_get_task() }; unsafe { @@ -714,7 +714,7 @@ Sometimes messages will be available on both endpoints at once. In this case, `select2` may return either `left` or `right`. */ -pub fn select2( +pub fn select2( a: RecvPacketBuffered, b: RecvPacketBuffered) -> Either<(Option, RecvPacketBuffered), @@ -739,12 +739,12 @@ impl Selectable for *PacketHeader { } /// Returns the index of an endpoint that is ready to receive. -pub fn selecti(endpoints: &[T]) -> uint { +pub fn selecti(endpoints: &[T]) -> uint { wait_many(endpoints) } /// Returns 0 or 1 depending on which endpoint is ready to receive -pub fn select2i(a: &A, b: &B) -> +pub fn select2i(a: &A, b: &B) -> Either<(), ()> { match wait_many([a.header(), b.header()]) { 0 => Left(()), @@ -757,7 +757,7 @@ pub fn select2i(a: &A, b: &B) -> list of the remaining endpoints. */ -pub fn select(endpoints: ~[RecvPacketBuffered]) +pub fn select(endpoints: ~[RecvPacketBuffered]) -> (uint, Option, ~[RecvPacketBuffered]) { let ready = wait_many(endpoints.map(|p| p.header())); @@ -852,7 +852,7 @@ pub struct RecvPacketBuffered { mut buffer: Option>, } -impl ::ops::Drop for RecvPacketBuffered { +impl ::ops::Drop for RecvPacketBuffered { fn finalize(&self) { //if self.p != none { // debug!("drop recv %?", option::get(self.p)); @@ -869,7 +869,7 @@ impl ::ops::Drop for RecvPacketBuffered { } } -impl RecvPacketBuffered { +impl RecvPacketBuffered { fn unwrap() -> *Packet { let mut p = None; p <-> self.p; @@ -884,7 +884,7 @@ impl RecvPacketBuffered { } } -impl Selectable for RecvPacketBuffered { +impl Selectable for RecvPacketBuffered { pure fn header() -> *PacketHeader { match self.p { Some(packet) => unsafe { @@ -923,7 +923,7 @@ endpoint. The send endpoint is returned to the caller and the receive endpoint is passed to the new task. */ -pub fn spawn_service( +pub fn spawn_service( init: extern fn() -> (SendPacketBuffered, RecvPacketBuffered), service: fn~(v: RecvPacketBuffered)) @@ -947,7 +947,7 @@ pub fn spawn_service( receive state. */ -pub fn spawn_service_recv( +pub fn spawn_service_recv( init: extern fn() -> (RecvPacketBuffered, SendPacketBuffered), service: fn~(v: SendPacketBuffered)) @@ -970,7 +970,7 @@ pub fn spawn_service_recv( // Streams - Make pipes a little easier in general. proto! streamp ( - Open:send { + Open:send { data(T) -> Open } ) @@ -1036,7 +1036,7 @@ pub fn stream() -> (Port, Chan) { (Port_(Port_ { endp: Some(s) }), Chan_(Chan_{ endp: Some(c) })) } -impl GenericChan for Chan { +impl GenericChan for Chan { fn send(x: T) { let mut endp = None; endp <-> self.endp; @@ -1045,7 +1045,7 @@ impl GenericChan for Chan { } } -impl GenericSmartChan for Chan { +impl GenericSmartChan for Chan { fn try_send(x: T) -> bool { let mut endp = None; @@ -1060,7 +1060,7 @@ impl GenericSmartChan for Chan { } } -impl GenericPort for Port { +impl GenericPort for Port { fn recv() -> T { let mut endp = None; endp <-> self.endp; @@ -1082,7 +1082,7 @@ impl GenericPort for Port { } } -impl Peekable for Port { +impl Peekable for Port { pure fn peek() -> bool { unsafe { let mut endp = None; @@ -1097,7 +1097,7 @@ impl Peekable for Port { } } -impl Selectable for Port { +impl Selectable for Port { pure fn header() -> *PacketHeader { unsafe { match self.endp { @@ -1113,13 +1113,13 @@ pub struct PortSet { mut ports: ~[pipes::Port], } -pub fn PortSet() -> PortSet{ +pub fn PortSet() -> PortSet{ PortSet { ports: ~[] } } -impl PortSet { +impl PortSet { fn add(port: pipes::Port) { self.ports.push(port) @@ -1132,7 +1132,7 @@ impl PortSet { } } -impl GenericPort for PortSet { +impl GenericPort for PortSet { fn try_recv() -> Option { let mut result = None; @@ -1162,7 +1162,7 @@ impl GenericPort for PortSet { } -impl Peekable for PortSet { +impl Peekable for PortSet { pure fn peek() -> bool { // It'd be nice to use self.port.each, but that version isn't // pure. @@ -1176,7 +1176,7 @@ impl Peekable for PortSet { /// A channel that can be shared between many senders. pub type SharedChan = private::Exclusive>; -impl GenericChan for SharedChan { +impl GenericChan for SharedChan { fn send(x: T) { let mut xx = Some(x); do self.with_imm |chan| { @@ -1187,7 +1187,7 @@ impl GenericChan for SharedChan { } } -impl GenericSmartChan for SharedChan { +impl GenericSmartChan for SharedChan { fn try_send(x: T) -> bool { let mut xx = Some(x); do self.with_imm |chan| { @@ -1204,7 +1204,7 @@ pub fn SharedChan(c: Chan) -> SharedChan { } /// Receive a message from one of two endpoints. -pub trait Select2 { +pub trait Select2 { /// Receive a message or return `None` if a connection closes. fn try_select() -> Either, Option>; /// Receive a message or fail if a connection closes. @@ -1247,17 +1247,17 @@ pub type ChanOne = oneshot::client::Oneshot; pub type PortOne = oneshot::server::Oneshot; /// Initialiase a (send-endpoint, recv-endpoint) oneshot pipe pair. -pub fn oneshot() -> (PortOne, ChanOne) { +pub fn oneshot() -> (PortOne, ChanOne) { let (chan, port) = oneshot::init(); (port, chan) } -impl PortOne { +impl PortOne { fn recv(self) -> T { recv_one(self) } fn try_recv(self) -> Option { try_recv_one(self) } } -impl ChanOne { +impl ChanOne { fn send(self, data: T) { send_one(self, data) } fn try_send(self, data: T) -> bool { try_send_one(self, data) } } @@ -1266,13 +1266,13 @@ impl ChanOne { * Receive a message from a oneshot pipe, failing if the connection was * closed. */ -pub fn recv_one(port: PortOne) -> T { +pub fn recv_one(port: PortOne) -> T { let oneshot::send(message) = recv(port); message } /// Receive a message from a oneshot pipe unless the connection was closed. -pub fn try_recv_one (port: PortOne) -> Option { +pub fn try_recv_one (port: PortOne) -> Option { let message = try_recv(port); if message.is_none() { None } @@ -1283,7 +1283,7 @@ pub fn try_recv_one (port: PortOne) -> Option { } /// Send a message on a oneshot pipe, failing if the connection was closed. -pub fn send_one(chan: ChanOne, data: T) { +pub fn send_one(chan: ChanOne, data: T) { oneshot::client::send(chan, data); } @@ -1291,7 +1291,7 @@ pub fn send_one(chan: ChanOne, data: T) { * Send a message on a oneshot pipe, or return false if the connection was * closed. */ -pub fn try_send_one(chan: ChanOne, data: T) +pub fn try_send_one(chan: ChanOne, data: T) -> bool { oneshot::client::try_send(chan, data).is_some() } diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 5b69c348c1591..465ddb361abf9 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -170,7 +170,7 @@ fn ArcDestruct(data: *libc::c_void) -> ArcDestruct { } } -pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) +pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) -> T { struct DeathThroes { mut ptr: Option<~ArcData>, @@ -246,7 +246,7 @@ pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) */ pub type SharedMutableState = ArcDestruct; -pub unsafe fn shared_mutable_state(data: T) -> +pub unsafe fn shared_mutable_state(data: T) -> SharedMutableState { let data = ~ArcData { count: 1, unwrapper: 0, data: Some(data) }; unsafe { @@ -256,7 +256,7 @@ pub unsafe fn shared_mutable_state(data: T) -> } #[inline(always)] -pub unsafe fn get_shared_mutable_state( +pub unsafe fn get_shared_mutable_state( rc: *SharedMutableState) -> *mut T { unsafe { @@ -268,7 +268,7 @@ pub unsafe fn get_shared_mutable_state( } } #[inline(always)] -pub unsafe fn get_shared_immutable_state( +pub unsafe fn get_shared_immutable_state( rc: &a/SharedMutableState) -> &a/T { unsafe { let ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); @@ -280,7 +280,7 @@ pub unsafe fn get_shared_immutable_state( } } -pub unsafe fn clone_shared_mutable_state(rc: &SharedMutableState) +pub unsafe fn clone_shared_mutable_state(rc: &SharedMutableState) -> SharedMutableState { unsafe { let ptr: ~ArcData = cast::reinterpret_cast(&(*rc).data); @@ -291,7 +291,7 @@ pub unsafe fn clone_shared_mutable_state(rc: &SharedMutableState) ArcDestruct((*rc).data) } -impl Clone for SharedMutableState { +impl Clone for SharedMutableState { fn clone(&self) -> SharedMutableState { unsafe { clone_shared_mutable_state(self) @@ -353,21 +353,21 @@ struct ExData { lock: LittleLock, mut failed: bool, mut data: T, } */ pub struct Exclusive { x: SharedMutableState> } -pub fn exclusive(user_data: T) -> Exclusive { +pub fn exclusive(user_data: T) -> Exclusive { let data = ExData { lock: LittleLock(), mut failed: false, mut data: user_data }; Exclusive { x: unsafe { shared_mutable_state(data) } } } -impl Clone for Exclusive { +impl Clone for Exclusive { // Duplicate an exclusive ARC, as std::arc::clone. fn clone(&self) -> Exclusive { Exclusive { x: unsafe { clone_shared_mutable_state(&self.x) } } } } -impl Exclusive { +impl Exclusive { // Exactly like std::arc::mutex_arc,access(), but with the little_lock // instead of a proper mutex. Same reason for being unsafe. // @@ -400,7 +400,7 @@ impl Exclusive { } // FIXME(#3724) make this a by-move method on the exclusive -pub fn unwrap_exclusive(arc: Exclusive) -> T { +pub fn unwrap_exclusive(arc: Exclusive) -> T { let Exclusive { x: x } = arc; let inner = unsafe { unwrap_shared_mutable_state(x) }; let ExData { data: data, _ } = inner; diff --git a/src/libcore/private/global.rs b/src/libcore/private/global.rs index 621ead48abc1a..10e4cd9ddb053 100644 --- a/src/libcore/private/global.rs +++ b/src/libcore/private/global.rs @@ -43,7 +43,7 @@ use uint; pub type GlobalDataKey = &fn(v: T); -pub unsafe fn global_data_clone_create( +pub unsafe fn global_data_clone_create( key: GlobalDataKey, create: &fn() -> ~T) -> T { /*! * Clone a global value or, if it has not been created, @@ -59,7 +59,7 @@ pub unsafe fn global_data_clone_create( global_data_clone_create_(key_ptr(key), create) } -unsafe fn global_data_clone_create_( +unsafe fn global_data_clone_create_( key: uint, create: &fn() -> ~T) -> T { let mut clone_value: Option = None; @@ -79,13 +79,13 @@ unsafe fn global_data_clone_create_( return clone_value.unwrap(); } -unsafe fn global_data_modify( +unsafe fn global_data_modify( key: GlobalDataKey, op: &fn(Option<~T>) -> Option<~T>) { global_data_modify_(key_ptr(key), op) } -unsafe fn global_data_modify_( +unsafe fn global_data_modify_( key: uint, op: &fn(Option<~T>) -> Option<~T>) { let mut old_dtor = None; @@ -124,7 +124,7 @@ unsafe fn global_data_modify_( } } -pub unsafe fn global_data_clone( +pub unsafe fn global_data_clone( key: GlobalDataKey) -> Option { let mut maybe_clone: Option = None; do global_data_modify(key) |current| { @@ -220,7 +220,7 @@ fn get_global_state() -> Exclusive { } } -fn key_ptr(key: GlobalDataKey) -> uint { +fn key_ptr(key: GlobalDataKey) -> uint { unsafe { let closure: Closure = reinterpret_cast(&key); return transmute(closure.code); diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 79dd29604e42e..a88b83465161d 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -109,7 +109,7 @@ impl Rand for bool { } } -impl Rand for Option { +impl Rand for Option { static fn rand(rng: rand::Rng) -> Option { if rng.gen_bool() { Some(Rand::rand(rng)) } else { None } @@ -143,7 +143,7 @@ pub struct Weighted { /// Extension methods for random number generators impl Rng { /// Return a random value for a Rand type - fn gen() -> T { + fn gen() -> T { Rand::rand(self) } @@ -302,7 +302,7 @@ impl Rng { * Choose an item respecting the relative weights, failing if the sum of * the weights is 0 */ - fn choose_weighted(v : &[Weighted]) -> T { + fn choose_weighted(v : &[Weighted]) -> T { self.choose_weighted_option(v).get() } diff --git a/src/libcore/reflect.rs b/src/libcore/reflect.rs index 8983c63f42a1f..ed7e485678e10 100644 --- a/src/libcore/reflect.rs +++ b/src/libcore/reflect.rs @@ -41,11 +41,11 @@ pub fn align(size: uint, align: uint) -> uint { pub struct MovePtrAdaptor { inner: V } -pub fn MovePtrAdaptor(v: V) -> MovePtrAdaptor { +pub fn MovePtrAdaptor(v: V) -> MovePtrAdaptor { MovePtrAdaptor { inner: v } } -impl MovePtrAdaptor { +impl MovePtrAdaptor { #[inline(always)] fn bump(sz: uint) { do self.inner.move_ptr() |p| { @@ -72,7 +72,7 @@ impl MovePtrAdaptor { } /// Abstract type-directed pointer-movement using the MovePtr trait -impl TyVisitor for MovePtrAdaptor { +impl TyVisitor for MovePtrAdaptor { fn visit_bot(&self) -> bool { self.align_to::<()>(); if ! self.inner.visit_bot() { return false; } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 64c62c925849f..b03eaeab3e0cc 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -37,7 +37,7 @@ pub enum Result { * If the result is an error */ #[inline(always)] -pub pure fn get(res: &Result) -> T { +pub pure fn get(res: &Result) -> T { match *res { Ok(copy t) => t, Err(ref the_err) => unsafe { @@ -100,7 +100,7 @@ pub pure fn is_err(res: &Result) -> bool { * result variants are converted to `either::left`. */ #[inline(always)] -pub pure fn to_either(res: &Result) +pub pure fn to_either(res: &Result) -> Either { match *res { Ok(copy res) => either::Right(res), @@ -220,7 +220,7 @@ pub pure fn map(res: &Result, op: fn(&T) -> U) * successful result while handling an error. */ #[inline(always)] -pub pure fn map_err(res: &Result, op: fn(&E) -> F) +pub pure fn map_err(res: &Result, op: fn(&E) -> F) -> Result { match *res { Ok(copy t) => Ok(t), @@ -261,7 +261,7 @@ impl Result { } } -impl Result { +impl Result { #[inline(always)] pure fn get(&self) -> T { get(self) } diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index fe37a2e155f0b..ae101faaf0264 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -51,7 +51,7 @@ pub type LocalDataKey = &fn(v: @T); * Remove a task-local data value from the table, returning the * reference that was originally created to insert it. */ -pub unsafe fn local_data_pop( +pub unsafe fn local_data_pop( key: LocalDataKey) -> Option<@T> { local_pop(rt::rust_get_task(), key) @@ -60,7 +60,7 @@ pub unsafe fn local_data_pop( * Retrieve a task-local data value. It will also be kept alive in the * table until explicitly removed. */ -pub unsafe fn local_data_get( +pub unsafe fn local_data_get( key: LocalDataKey) -> Option<@T> { local_get(rt::rust_get_task(), key) @@ -69,7 +69,7 @@ pub unsafe fn local_data_get( * Store a value in task-local data. If this key already has a value, * that value is overwritten (and its destructor is run). */ -pub unsafe fn local_data_set( +pub unsafe fn local_data_set( key: LocalDataKey, data: @T) { local_set(rt::rust_get_task(), key, data) @@ -78,7 +78,7 @@ pub unsafe fn local_data_set( * Modify a task-local data value. If the function returns 'None', the * data is removed (and its reference dropped). */ -pub unsafe fn local_data_modify( +pub unsafe fn local_data_modify( key: LocalDataKey, modify_fn: fn(Option<@T>) -> Option<@T>) { diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index 949c36545dd03..3ac457b23d16e 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -26,7 +26,7 @@ use rt::rust_task; type rust_task = libc::c_void; pub trait LocalData { } -impl LocalData for @T { } +impl LocalData for @T { } impl Eq for LocalData { pure fn eq(&self, other: &@LocalData) -> bool { @@ -79,7 +79,7 @@ unsafe fn get_task_local_map(task: *rust_task) -> TaskLocalMap { } } -unsafe fn key_to_key_value( +unsafe fn key_to_key_value( key: LocalDataKey) -> *libc::c_void { // Keys are closures, which are (fnptr,envptr) pairs. Use fnptr. @@ -89,7 +89,7 @@ unsafe fn key_to_key_value( } // If returning Some(..), returns with @T with the map's reference. Careful! -unsafe fn local_data_lookup( +unsafe fn local_data_lookup( map: TaskLocalMap, key: LocalDataKey) -> Option<(uint, *libc::c_void)> { @@ -107,7 +107,7 @@ unsafe fn local_data_lookup( } } -unsafe fn local_get_helper( +unsafe fn local_get_helper( task: *rust_task, key: LocalDataKey, do_pop: bool) -> Option<@T> { @@ -129,21 +129,21 @@ unsafe fn local_get_helper( } -pub unsafe fn local_pop( +pub unsafe fn local_pop( task: *rust_task, key: LocalDataKey) -> Option<@T> { local_get_helper(task, key, true) } -pub unsafe fn local_get( +pub unsafe fn local_get( task: *rust_task, key: LocalDataKey) -> Option<@T> { local_get_helper(task, key, false) } -pub unsafe fn local_set( +pub unsafe fn local_set( task: *rust_task, key: LocalDataKey, data: @T) { let map = get_task_local_map(task); @@ -175,7 +175,7 @@ pub unsafe fn local_set( } } -pub unsafe fn local_modify( +pub unsafe fn local_modify( task: *rust_task, key: LocalDataKey, modify_fn: fn(Option<@T>) -> Option<@T>) { diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 4b15d1f76c98a..54dfa7459a1e7 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -396,7 +396,7 @@ impl TaskBuilder { spawn::spawn_raw(opts, (x.gen_body)(f)); } /// Runs a task, while transfering ownership of one argument to the child. - fn spawn_with(arg: A, f: fn~(v: A)) { + fn spawn_with(arg: A, f: fn~(v: A)) { let arg = ~mut Some(arg); do self.spawn || { f(option::swap_unwrap(arg)) @@ -416,7 +416,7 @@ impl TaskBuilder { * # Failure * Fails if a future_result was already set for this task. */ - fn try(f: fn~() -> T) -> Result { + fn try(f: fn~() -> T) -> Result { let (po, ch) = stream::(); let mut result = None; diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index 10efa9196a7bb..4b2cd3c2fab5b 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -197,7 +197,7 @@ impl IterBytes for int { } } -impl IterBytes for &[A] { +impl IterBytes for &[A] { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { for (*self).each |elt| { @@ -208,7 +208,7 @@ impl IterBytes for &[A] { } } -impl IterBytes for (A,B) { +impl IterBytes for (A,B) { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { match *self { @@ -219,7 +219,7 @@ impl IterBytes for (A,B) { } } -impl IterBytes for (A,B,C) { +impl IterBytes for (A,B,C) { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { match *self { @@ -235,21 +235,21 @@ pure fn borrow(a: &x/[A]) -> &x/[A] { a } -impl IterBytes for ~[A] { +impl IterBytes for ~[A] { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { borrow(*self).iter_bytes(lsb0, f) } } -impl IterBytes for @[A] { +impl IterBytes for @[A] { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { borrow(*self).iter_bytes(lsb0, f) } } -pub pure fn iter_bytes_2(a: &A, b: &B, +pub pure fn iter_bytes_2(a: &A, b: &B, lsb0: bool, z: Cb) { let mut flag = true; a.iter_bytes(lsb0, |bytes| {flag = z(bytes); flag}); @@ -379,7 +379,7 @@ impl IterBytes for @str { } } -impl IterBytes for Option { +impl IterBytes for Option { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { match *self { @@ -389,21 +389,21 @@ impl IterBytes for Option { } } -impl IterBytes for &A { +impl IterBytes for &A { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { (**self).iter_bytes(lsb0, f); } } -impl IterBytes for @A { +impl IterBytes for @A { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { (**self).iter_bytes(lsb0, f); } } -impl IterBytes for ~A { +impl IterBytes for ~A { #[inline(always)] pure fn iter_bytes(&self, lsb0: bool, f: Cb) { (**self).iter_bytes(lsb0, f); @@ -424,7 +424,7 @@ trait ToBytes { fn to_bytes(&self, lsb0: bool) -> ~[u8]; } -impl ToBytes for A { +impl ToBytes for A { fn to_bytes(&self, lsb0: bool) -> ~[u8] { do io::with_bytes_writer |wr| { for self.iter_bytes(lsb0) |bytes| { diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 4cccc1d26382c..0145adc77b826 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -45,7 +45,7 @@ impl ToStr for @str { // FIXME #4898: impl for one-tuples -impl ToStr for (A, B) { +impl ToStr for (A, B) { #[inline(always)] pure fn to_str(&self) -> ~str { // FIXME(#4760): this causes an llvm assertion @@ -57,7 +57,7 @@ impl ToStr for (A, B) { } } } -impl ToStr for (A, B, C) { +impl ToStr for (A, B, C) { #[inline(always)] pure fn to_str(&self) -> ~str { // FIXME(#4760): this causes an llvm assertion @@ -74,7 +74,7 @@ impl ToStr for (A, B, C) { } } -impl ToStr for ~[A] { +impl ToStr for ~[A] { #[inline(always)] pure fn to_str(&self) -> ~str { unsafe { @@ -94,11 +94,11 @@ impl ToStr for ~[A] { } } -impl ToStr for @A { +impl ToStr for @A { #[inline(always)] pure fn to_str(&self) -> ~str { ~"@" + (**self).to_str() } } -impl ToStr for ~A { +impl ToStr for ~A { #[inline(always)] pure fn to_str(&self) -> ~str { ~"~" + (**self).to_str() } } diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index e49c1d26a0630..dde7d718c13d5 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -20,7 +20,7 @@ pub trait CopyableTuple { pure fn swap() -> (U, T); } -impl CopyableTuple for (T, U) { +impl CopyableTuple for (T, U) { /// Return the first element of self #[inline(always)] @@ -70,7 +70,7 @@ pub trait ExtendedTupleOps { fn map(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C]; } -impl ExtendedTupleOps for (&[A], &[B]) { +impl ExtendedTupleOps for (&[A], &[B]) { #[inline(always)] fn zip(&self) -> ~[(A, B)] { match *self { @@ -90,7 +90,7 @@ impl ExtendedTupleOps for (&[A], &[B]) { } } -impl ExtendedTupleOps for (~[A], ~[B]) { +impl ExtendedTupleOps for (~[A], ~[B]) { #[inline(always)] fn zip(&self) -> ~[(A, B)] { @@ -114,7 +114,7 @@ impl ExtendedTupleOps for (~[A], ~[B]) { // FIXME #4898: impl for one-tuples #[cfg(notest)] -impl Eq for (A, B) { +impl Eq for (A, B) { #[inline(always)] pure fn eq(&self, other: &(A, B)) -> bool { match (*self) { @@ -130,7 +130,7 @@ impl Eq for (A, B) { } #[cfg(notest)] -impl Ord for (A, B) { +impl Ord for (A, B) { #[inline(always)] pure fn lt(&self, other: &(A, B)) -> bool { match (*self) { @@ -155,7 +155,7 @@ impl Ord for (A, B) { } #[cfg(notest)] -impl Eq for (A, B, C) { +impl Eq for (A, B, C) { #[inline(always)] pure fn eq(&self, other: &(A, B, C)) -> bool { match (*self) { @@ -172,7 +172,7 @@ impl Eq for (A, B, C) { } #[cfg(notest)] -impl Ord for (A, B, C) { +impl Ord for (A, B, C) { #[inline(always)] pure fn lt(&self, other: &(A, B, C)) -> bool { match (*self) { diff --git a/src/libcore/util.rs b/src/libcore/util.rs index eea172a43ced1..629c4a3291ce0 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -28,7 +28,7 @@ pub pure fn ignore(_x: T) { } /// Sets `*ptr` to `new_value`, invokes `op()`, and then restores the /// original value of `*ptr`. #[inline(always)] -pub fn with( +pub fn with( ptr: &mut T, new_value: T, op: &fn() -> R) -> R diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index b55a3bee8b0e0..a7edd0ea9c353 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -135,12 +135,12 @@ pub pure fn from_fn(n_elts: uint, op: iter::InitOp) -> ~[T] { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value `t`. */ -pub pure fn from_elem(n_elts: uint, t: T) -> ~[T] { +pub pure fn from_elem(n_elts: uint, t: T) -> ~[T] { from_fn(n_elts, |_i| copy t) } /// Creates a new unique vector with the same contents as the slice -pub pure fn from_slice(t: &[T]) -> ~[T] { +pub pure fn from_slice(t: &[T]) -> ~[T] { from_fn(t.len(), |i| t[i]) } @@ -216,10 +216,10 @@ pub pure fn cast_from_mut(v: ~[mut T]) -> ~[T] { // Accessors /// Returns the first element of a vector -pub pure fn head(v: &[const T]) -> T { v[0] } +pub pure fn head(v: &[const T]) -> T { v[0] } /// Returns a vector containing all but the first element of a slice -pub pure fn tail(v: &[const T]) -> ~[T] { +pub pure fn tail(v: &[const T]) -> ~[T] { slice(v, 1u, len(v)).to_vec() } @@ -227,18 +227,18 @@ pub pure fn tail(v: &[const T]) -> ~[T] { * Returns a vector containing all but the first `n` \ * elements of a slice */ -pub pure fn tailn(v: &[const T], n: uint) -> ~[T] { +pub pure fn tailn(v: &[const T], n: uint) -> ~[T] { slice(v, n, len(v)).to_vec() } /// Returns a vector containing all but the last element of a slice -pub pure fn init(v: &[const T]) -> ~[T] { +pub pure fn init(v: &[const T]) -> ~[T] { assert len(v) != 0u; slice(v, 0u, len(v) - 1u).to_vec() } /// Returns the last element of the slice `v`, failing if the slice is empty. -pub pure fn last(v: &[const T]) -> T { +pub pure fn last(v: &[const T]) -> T { if len(v) == 0u { fail!(~"last_unsafe: empty vector") } v[len(v) - 1u] } @@ -247,7 +247,7 @@ pub pure fn last(v: &[const T]) -> T { * Returns `Some(x)` where `x` is the last element of the slice `v`, * or `none` if the vector is empty. */ -pub pure fn last_opt(v: &[const T]) -> Option { +pub pure fn last_opt(v: &[const T]) -> Option { if len(v) == 0u { return None; } Some(v[len(v) - 1u]) } @@ -300,7 +300,7 @@ pub pure fn const_slice(v: &r/[const T], start: uint, /// Copies /// Split the vector `v` by applying each element against the predicate `f`. -pub fn split(v: &[T], f: fn(t: &T) -> bool) -> ~[~[T]] { +pub fn split(v: &[T], f: fn(t: &T) -> bool) -> ~[~[T]] { let ln = len(v); if (ln == 0u) { return ~[] } @@ -323,7 +323,7 @@ pub fn split(v: &[T], f: fn(t: &T) -> bool) -> ~[~[T]] { * Split the vector `v` by applying each element against the predicate `f` up * to `n` times. */ -pub fn splitn(v: &[T], n: uint, f: fn(t: &T) -> bool) -> ~[~[T]] { +pub fn splitn(v: &[T], n: uint, f: fn(t: &T) -> bool) -> ~[~[T]] { let ln = len(v); if (ln == 0u) { return ~[] } @@ -349,7 +349,7 @@ pub fn splitn(v: &[T], n: uint, f: fn(t: &T) -> bool) -> ~[~[T]] { * Reverse split the vector `v` by applying each element against the predicate * `f`. */ -pub fn rsplit(v: &[T], f: fn(t: &T) -> bool) -> ~[~[T]] { +pub fn rsplit(v: &[T], f: fn(t: &T) -> bool) -> ~[~[T]] { let ln = len(v); if (ln == 0) { return ~[] } @@ -373,7 +373,7 @@ pub fn rsplit(v: &[T], f: fn(t: &T) -> bool) -> ~[~[T]] { * Reverse split the vector `v` by applying each element against the predicate * `f` up to `n times. */ -pub fn rsplitn(v: &[T], n: uint, f: fn(t: &T) -> bool) -> ~[~[T]] { +pub fn rsplitn(v: &[T], n: uint, f: fn(t: &T) -> bool) -> ~[~[T]] { let ln = len(v); if (ln == 0u) { return ~[] } @@ -421,7 +421,7 @@ pub fn partition(v: ~[T], f: fn(&T) -> bool) -> (~[T], ~[T]) { * Partitions a vector into two new vectors: those that satisfies the * predicate, and those that do not. */ -pub pure fn partitioned(v: &[T], f: fn(&T) -> bool) -> (~[T], ~[T]) { +pub pure fn partitioned(v: &[T], f: fn(&T) -> bool) -> (~[T], ~[T]) { let mut lefts = ~[]; let mut rights = ~[]; @@ -616,7 +616,7 @@ fn push_slow(v: &mut ~[T], initval: T) { } #[inline(always)] -pub fn push_all(v: &mut ~[T], rhs: &[const T]) { +pub fn push_all(v: &mut ~[T], rhs: &[const T]) { let new_len = v.len() + rhs.len(); reserve(&mut *v, new_len); @@ -662,7 +662,7 @@ pub fn truncate(v: &mut ~[T], newlen: uint) { * Remove consecutive repeated elements from a vector; if the vector is * sorted, this removes all duplicates. */ -pub fn dedup(v: &mut ~[T]) { +pub fn dedup(v: &mut ~[T]) { unsafe { if v.len() < 1 { return; } let mut last_written = 0, next_to_read = 1; @@ -700,7 +700,7 @@ pub fn dedup(v: &mut ~[T]) { // Appending #[inline(always)] -pub pure fn append(lhs: ~[T], rhs: &[const T]) -> ~[T] { +pub pure fn append(lhs: ~[T], rhs: &[const T]) -> ~[T] { let mut v = lhs; unsafe { v.push_all(rhs); @@ -724,7 +724,7 @@ pub pure fn append_one(lhs: ~[T], x: T) -> ~[T] { * * n - The number of elements to add * * initval - The value for the new elements */ -pub fn grow(v: &mut ~[T], n: uint, initval: &T) { +pub fn grow(v: &mut ~[T], n: uint, initval: &T) { let new_len = v.len() + n; reserve_at_least(&mut *v, new_len); let mut i: uint = 0u; @@ -766,7 +766,7 @@ pub fn grow_fn(v: &mut ~[T], n: uint, op: iter::InitOp) { * of the vector, expands the vector by replicating `initval` to fill the * intervening space. */ -pub fn grow_set(v: &mut ~[T], index: uint, initval: &T, val: T) { +pub fn grow_set(v: &mut ~[T], index: uint, initval: &T, val: T) { let l = v.len(); if index >= l { grow(&mut *v, index - l + 1u, initval); } v[index] = val; @@ -813,7 +813,7 @@ pub pure fn flat_map(v: &[T], f: fn(t: &T) -> ~[U]) -> ~[U] { } /// Apply a function to each pair of elements and return the results -pub pure fn map2(v0: &[T], v1: &[U], +pub pure fn map2(v0: &[T], v1: &[U], f: fn(t: &T, v: &U) -> V) -> ~[V] { let v0_len = len(v0); if v0_len != len(v1) { fail!(); } @@ -891,7 +891,7 @@ pub fn filter(v: ~[T], f: fn(t: &T) -> bool) -> ~[T] { * Apply function `f` to each element of `v` and return a vector containing * only those elements for which `f` returned true. */ -pub pure fn filtered(v: &[T], f: fn(t: &T) -> bool) -> ~[T] { +pub pure fn filtered(v: &[T], f: fn(t: &T) -> bool) -> ~[T] { let mut result = ~[]; for each(v) |elem| { if f(elem) { unsafe { result.push(*elem); } } @@ -924,14 +924,14 @@ pub fn retain(v: &mut ~[T], f: pure fn(t: &T) -> bool) { * * Flattens a vector of vectors of T into a single vector of T. */ -pub pure fn concat(v: &[~[T]]) -> ~[T] { +pub pure fn concat(v: &[~[T]]) -> ~[T] { let mut r = ~[]; for each(v) |inner| { unsafe { r.push_all(*inner); } } r } /// Concatenate a vector of vectors, placing a given separator between each -pub pure fn connect(v: &[~[T]], sep: &T) -> ~[T] { +pub pure fn connect(v: &[~[T]], sep: &T) -> ~[T] { let mut r: ~[T] = ~[]; let mut first = true; for each(v) |inner| { @@ -1060,13 +1060,13 @@ pub pure fn all2(v0: &[T], v1: &[U], } /// Return true if a vector contains an element with the given value -pub pure fn contains(v: &[T], x: &T) -> bool { +pub pure fn contains(v: &[T], x: &T) -> bool { for each(v) |elt| { if *x == *elt { return true; } } return false; } /// Returns the number of elements that are equal to a given value -pub pure fn count(v: &[T], x: &T) -> uint { +pub pure fn count(v: &[T], x: &T) -> uint { let mut cnt = 0u; for each(v) |elt| { if *x == *elt { cnt += 1u; } } return cnt; @@ -1079,7 +1079,7 @@ pub pure fn count(v: &[T], x: &T) -> uint { * When function `f` returns true then an option containing the element * is returned. If `f` matches no elements then none is returned. */ -pub pure fn find(v: &[T], f: fn(t: &T) -> bool) -> Option { +pub pure fn find(v: &[T], f: fn(t: &T) -> bool) -> Option { find_between(v, 0u, len(v), f) } @@ -1090,7 +1090,7 @@ pub pure fn find(v: &[T], f: fn(t: &T) -> bool) -> Option { * [`start`, `end`). When function `f` returns true then an option containing * the element is returned. If `f` matches no elements then none is returned. */ -pub pure fn find_between(v: &[T], start: uint, end: uint, +pub pure fn find_between(v: &[T], start: uint, end: uint, f: fn(t: &T) -> bool) -> Option { position_between(v, start, end, f).map(|i| v[*i]) } @@ -1102,7 +1102,7 @@ pub pure fn find_between(v: &[T], start: uint, end: uint, * `f` returns true then an option containing the element is returned. If `f` * matches no elements then none is returned. */ -pub pure fn rfind(v: &[T], f: fn(t: &T) -> bool) -> Option { +pub pure fn rfind(v: &[T], f: fn(t: &T) -> bool) -> Option { rfind_between(v, 0u, len(v), f) } @@ -1113,13 +1113,13 @@ pub pure fn rfind(v: &[T], f: fn(t: &T) -> bool) -> Option { * [`start`, `end`). When function `f` returns true then an option containing * the element is returned. If `f` matches no elements then none is return. */ -pub pure fn rfind_between(v: &[T], start: uint, end: uint, +pub pure fn rfind_between(v: &[T], start: uint, end: uint, f: fn(t: &T) -> bool) -> Option { rposition_between(v, start, end, f).map(|i| v[*i]) } /// Find the first index containing a matching value -pub pure fn position_elem(v: &[T], x: &T) -> Option { +pub pure fn position_elem(v: &[T], x: &T) -> Option { position(v, |y| *x == *y) } @@ -1151,7 +1151,7 @@ pub pure fn position_between(v: &[T], start: uint, end: uint, } /// Find the last index containing a matching value -pure fn rposition_elem(v: &[T], x: &T) -> Option { +pure fn rposition_elem(v: &[T], x: &T) -> Option { rposition(v, |y| *x == *y) } @@ -1193,7 +1193,7 @@ pub pure fn rposition_between(v: &[T], start: uint, end: uint, /** * Convert a vector of pairs into a pair of vectors, by reference. As unzip(). */ -pure fn unzip_slice(v: &[(T, U)]) -> (~[T], ~[U]) { +pure fn unzip_slice(v: &[(T, U)]) -> (~[T], ~[U]) { let mut ts = ~[], us = ~[]; for each(v) |p| { let (t, u) = *p; @@ -1228,7 +1228,7 @@ pub pure fn unzip(v: ~[(T, U)]) -> (~[T], ~[U]) { /** * Convert two vectors to a vector of pairs, by reference. As zip(). */ -pub pure fn zip_slice(v: &[const T], u: &[const U]) +pub pure fn zip_slice(v: &[const T], u: &[const U]) -> ~[(T, U)] { let mut zipped = ~[]; let sz = len(v); @@ -1279,7 +1279,7 @@ pub fn reverse(v: &mut [T]) { } /// Returns a vector with the order of elements reversed -pub pure fn reversed(v: &[const T]) -> ~[T] { +pub pure fn reversed(v: &[const T]) -> ~[T] { let mut rs: ~[T] = ~[]; let mut i = len::(v); if i == 0 { return (rs); } else { i -= 1; } @@ -1445,7 +1445,7 @@ pub fn each2(v1: &[U], v2: &[T], f: fn(u: &U, t: &T) -> bool) { * The total number of permutations produced is `len(v)!`. If `v` contains * repeated elements, then some permutations are repeated. */ -pure fn each_permutation(v: &[T], put: fn(ts: &[T]) -> bool) { +pure fn each_permutation(v: &[T], put: fn(ts: &[T]) -> bool) { let ln = len(v); if ln <= 1 { put(v); @@ -1469,7 +1469,7 @@ pure fn each_permutation(v: &[T], put: fn(ts: &[T]) -> bool) { } } -pub pure fn windowed(nn: uint, xx: &[TT]) -> ~[~[TT]] { +pub pure fn windowed(nn: uint, xx: &[TT]) -> ~[~[TT]] { let mut ww = ~[]; assert 1u <= nn; for vec::eachi (xx) |ii, _x| { @@ -1536,7 +1536,7 @@ pub pure fn as_mut_buf(s: &mut [T], // Equality -pure fn eq(a: &[T], b: &[T]) -> bool { +pure fn eq(a: &[T], b: &[T]) -> bool { let (a_len, b_len) = (a.len(), b.len()); if a_len != b_len { return false; } @@ -1550,7 +1550,7 @@ pure fn eq(a: &[T], b: &[T]) -> bool { } #[cfg(notest)] -impl Eq for &[T] { +impl Eq for &[T] { #[inline(always)] pure fn eq(&self, other: & &self/[T]) -> bool { eq((*self), (*other)) } #[inline(always)] @@ -1559,7 +1559,7 @@ impl Eq for &[T] { #[cfg(notest)] -impl Eq for ~[T] { +impl Eq for ~[T] { #[inline(always)] pure fn eq(&self, other: &~[T]) -> bool { eq((*self), (*other)) } #[inline(always)] @@ -1567,7 +1567,7 @@ impl Eq for ~[T] { } #[cfg(notest)] -impl Eq for @[T] { +impl Eq for @[T] { #[inline(always)] pure fn eq(&self, other: &@[T]) -> bool { eq((*self), (*other)) } #[inline(always)] @@ -1576,7 +1576,7 @@ impl Eq for @[T] { // Lexicographical comparison -pure fn lt(a: &[T], b: &[T]) -> bool { +pure fn lt(a: &[T], b: &[T]) -> bool { let (a_len, b_len) = (a.len(), b.len()); let mut end = uint::min(a_len, b_len); @@ -1591,12 +1591,12 @@ pure fn lt(a: &[T], b: &[T]) -> bool { return a_len < b_len; } -pure fn le(a: &[T], b: &[T]) -> bool { !lt(b, a) } -pure fn ge(a: &[T], b: &[T]) -> bool { !lt(a, b) } -pure fn gt(a: &[T], b: &[T]) -> bool { lt(b, a) } +pure fn le(a: &[T], b: &[T]) -> bool { !lt(b, a) } +pure fn ge(a: &[T], b: &[T]) -> bool { !lt(a, b) } +pure fn gt(a: &[T], b: &[T]) -> bool { lt(b, a) } #[cfg(notest)] -impl Ord for &[T] { +impl Ord for &[T] { #[inline(always)] pure fn lt(&self, other: & &self/[T]) -> bool { lt((*self), (*other)) } #[inline(always)] @@ -1608,7 +1608,7 @@ impl Ord for &[T] { } #[cfg(notest)] -impl Ord for ~[T] { +impl Ord for ~[T] { #[inline(always)] pure fn lt(&self, other: &~[T]) -> bool { lt((*self), (*other)) } #[inline(always)] @@ -1620,7 +1620,7 @@ impl Ord for ~[T] { } #[cfg(notest)] -impl Ord for @[T] { +impl Ord for @[T] { #[inline(always)] pure fn lt(&self, other: &@[T]) -> bool { lt((*self), (*other)) } #[inline(always)] @@ -1637,7 +1637,7 @@ pub mod traits { use ops::Add; use vec::append; - impl Add<&[const T],~[T]> for ~[T] { + impl Add<&[const T],~[T]> for ~[T] { #[inline(always)] pure fn add(&self, rhs: & &self/[const T]) -> ~[T] { append(copy *self, (*rhs)) @@ -1664,7 +1664,7 @@ pub trait CopyableVector { } /// Extension methods for vectors -impl CopyableVector for &[const T] { +impl CopyableVector for &[const T] { /// Returns the first element of a vector #[inline] pure fn head(&self) -> T { head(*self) } @@ -1690,13 +1690,13 @@ impl CopyableVector for &[const T] { pub trait ImmutableVector { pure fn view(&self, start: uint, end: uint) -> &self/[T]; - pure fn foldr(&self, z: U, p: fn(t: &T, u: U) -> U) -> U; + pure fn foldr(&self, z: U, p: fn(t: &T, u: U) -> U) -> U; pure fn map(&self, f: fn(t: &T) -> U) -> ~[U]; pure fn mapi(&self, f: fn(uint, t: &T) -> U) -> ~[U]; fn map_r(&self, f: fn(x: &T) -> U) -> ~[U]; pure fn alli(&self, f: fn(uint, t: &T) -> bool) -> bool; pure fn flat_map(&self, f: fn(t: &T) -> ~[U]) -> ~[U]; - pure fn filter_mapped(&self, f: fn(t: &T) -> Option) -> ~[U]; + pure fn filter_mapped(&self, f: fn(t: &T) -> Option) -> ~[U]; } /// Extension methods for vectors @@ -1709,7 +1709,7 @@ impl ImmutableVector for &[T] { /// Reduce a vector from right to left #[inline] - pure fn foldr(&self, z: U, p: fn(t: &T, u: U) -> U) -> U { + pure fn foldr(&self, z: U, p: fn(t: &T, u: U) -> U) -> U { foldr(*self, z, p) } @@ -1759,19 +1759,19 @@ impl ImmutableVector for &[T] { * the resulting vector. */ #[inline] - pure fn filter_mapped(&self, f: fn(t: &T) -> Option) -> ~[U] { + pure fn filter_mapped(&self, f: fn(t: &T) -> Option) -> ~[U] { filter_mapped(*self, f) } } -pub trait ImmutableEqVector { +pub trait ImmutableEqVector { pure fn position(&self, f: fn(t: &T) -> bool) -> Option; pure fn position_elem(&self, t: &T) -> Option; pure fn rposition(&self, f: fn(t: &T) -> bool) -> Option; pure fn rposition_elem(&self, t: &T) -> Option; } -impl ImmutableEqVector for &[T] { +impl ImmutableEqVector for &[T] { /** * Find the first index matching some predicate * @@ -1816,7 +1816,7 @@ pub trait ImmutableCopyableVector { } /// Extension methods for vectors -impl ImmutableCopyableVector for &[T] { +impl ImmutableCopyableVector for &[T] { /** * Construct a new vector from the elements of a vector for which some * predicate holds. @@ -1949,13 +1949,13 @@ impl Mutable for ~[T] { fn clear(&mut self) { self.truncate(0) } } -pub trait OwnedCopyableVector { +pub trait OwnedCopyableVector { fn push_all(&mut self, rhs: &[const T]); fn grow(&mut self, n: uint, initval: &T); fn grow_set(&mut self, index: uint, initval: &T, val: T); } -impl OwnedCopyableVector for ~[T] { +impl OwnedCopyableVector for ~[T] { #[inline] fn push_all(&mut self, rhs: &[const T]) { push_all(self, rhs); @@ -1972,11 +1972,11 @@ impl OwnedCopyableVector for ~[T] { } } -trait OwnedEqVector { +trait OwnedEqVector { fn dedup(&mut self); } -impl OwnedEqVector for ~[T] { +impl OwnedEqVector for ~[T] { #[inline] fn dedup(&mut self) { dedup(self) @@ -2086,7 +2086,7 @@ pub mod raw { * Unchecked vector indexing. */ #[inline(always)] - pub unsafe fn get(v: &[const T], i: uint) -> T { + pub unsafe fn get(v: &[const T], i: uint) -> T { as_const_buf(v, |p, _len| *ptr::const_offset(p, i)) } @@ -2324,24 +2324,24 @@ impl iter::ExtendedIter for @[A] { } } -impl iter::EqIter for &[A] { +impl iter::EqIter for &[A] { pub pure fn contains(&self, x: &A) -> bool { iter::contains(self, x) } pub pure fn count(&self, x: &A) -> uint { iter::count(self, x) } } // FIXME(#4148): This should be redundant -impl iter::EqIter for ~[A] { +impl iter::EqIter for ~[A] { pub pure fn contains(&self, x: &A) -> bool { iter::contains(self, x) } pub pure fn count(&self, x: &A) -> uint { iter::count(self, x) } } // FIXME(#4148): This should be redundant -impl iter::EqIter for @[A] { +impl iter::EqIter for @[A] { pub pure fn contains(&self, x: &A) -> bool { iter::contains(self, x) } pub pure fn count(&self, x: &A) -> uint { iter::count(self, x) } } -impl iter::CopyableIter for &[A] { +impl iter::CopyableIter for &[A] { pure fn filter_to_vec(&self, pred: fn(&A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } @@ -2352,7 +2352,7 @@ impl iter::CopyableIter for &[A] { } // FIXME(#4148): This should be redundant -impl iter::CopyableIter for ~[A] { +impl iter::CopyableIter for ~[A] { pure fn filter_to_vec(&self, pred: fn(&A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } @@ -2363,7 +2363,7 @@ impl iter::CopyableIter for ~[A] { } // FIXME(#4148): This should be redundant -impl iter::CopyableIter for @[A] { +impl iter::CopyableIter for @[A] { pure fn filter_to_vec(&self, pred: fn(&A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } @@ -2373,19 +2373,19 @@ impl iter::CopyableIter for @[A] { } } -impl iter::CopyableOrderedIter for &[A] { +impl iter::CopyableOrderedIter for &[A] { pure fn min(&self) -> A { iter::min(self) } pure fn max(&self) -> A { iter::max(self) } } // FIXME(#4148): This should be redundant -impl iter::CopyableOrderedIter for ~[A] { +impl iter::CopyableOrderedIter for ~[A] { pure fn min(&self) -> A { iter::min(self) } pure fn max(&self) -> A { iter::max(self) } } // FIXME(#4148): This should be redundant -impl iter::CopyableOrderedIter for @[A] { +impl iter::CopyableOrderedIter for @[A] { pure fn min(&self) -> A { iter::min(self) } pure fn max(&self) -> A { iter::max(self) } } diff --git a/src/libfuzzer/cycles.rs b/src/libfuzzer/cycles.rs index a64700494c897..7288b6d261d2c 100644 --- a/src/libfuzzer/cycles.rs +++ b/src/libfuzzer/cycles.rs @@ -18,7 +18,7 @@ fn under(r : rand::rng, n : uint) -> uint { } // random choice from a vec -fn choice(r : rand::rng, v : ~[const T]) -> T { +fn choice(r : rand::rng, v : ~[const T]) -> T { assert vec::len(v) != 0u; v[under(r, vec::len(v))] } diff --git a/src/libfuzzer/ivec_fuzz.rs b/src/libfuzzer/ivec_fuzz.rs index eadc706fe13b2..25dc14c3d7888 100644 --- a/src/libfuzzer/ivec_fuzz.rs +++ b/src/libfuzzer/ivec_fuzz.rs @@ -32,22 +32,22 @@ extern mod std; use vec::slice; use vec::len; -fn vec_omit(v: ~[T], i: uint) -> ~[T] { +fn vec_omit(v: ~[T], i: uint) -> ~[T] { slice(v, 0u, i) + slice(v, i + 1u, len(v)) } -fn vec_dup(v: ~[T], i: uint) -> ~[T] { +fn vec_dup(v: ~[T], i: uint) -> ~[T] { slice(v, 0u, i) + [v[i]] + slice(v, i, len(v)) } -fn vec_swadj(v: ~[T], i: uint) -> ~[T] { +fn vec_swadj(v: ~[T], i: uint) -> ~[T] { slice(v, 0u, i) + [v[i + 1u], v[i]] + slice(v, i + 2u, len(v)) } -fn vec_prefix(v: ~[T], i: uint) -> ~[T] { slice(v, 0u, i) } -fn vec_suffix(v: ~[T], i: uint) -> ~[T] { slice(v, i, len(v)) } +fn vec_prefix(v: ~[T], i: uint) -> ~[T] { slice(v, 0u, i) } +fn vec_suffix(v: ~[T], i: uint) -> ~[T] { slice(v, i, len(v)) } -fn vec_poke(v: ~[T], i: uint, x: T) -> ~[T] { +fn vec_poke(v: ~[T], i: uint, x: T) -> ~[T] { slice(v, 0u, i) + ~[x] + slice(v, i + 1u, len(v)) } -fn vec_insert(v: ~[T], i: uint, x: T) -> ~[T] { +fn vec_insert(v: ~[T], i: uint, x: T) -> ~[T] { slice(v, 0u, i) + ~[x] + slice(v, i, len(v)) } @@ -59,7 +59,7 @@ fn ix(skip_low: uint, skip_high: uint, length: uint, it: block(uint)) { // Returns a bunch of modified versions of v, some of which introduce // new elements (borrowed from xs). -fn vec_edits(v: ~[T], xs: ~[T]) -> ~[~[T]] { +fn vec_edits(v: ~[T], xs: ~[T]) -> ~[~[T]] { let edits: ~[~[T]] = ~[]; let Lv: uint = len(v); diff --git a/src/libfuzzer/rand_util.rs b/src/libfuzzer/rand_util.rs index cb074eecd6db4..507d0666da029 100644 --- a/src/libfuzzer/rand_util.rs +++ b/src/libfuzzer/rand_util.rs @@ -17,7 +17,7 @@ fn under(r : rand::rng, n : uint) -> uint { } // random choice from a vec -fn choice(r : rand::rng, v : ~[T]) -> T { +fn choice(r : rand::rng, v : ~[T]) -> T { assert vec::len(v) != 0u; v[under(r, vec::len(v))] } @@ -35,7 +35,7 @@ fn shuffle(r : rand::rng, &v : ~[T]) { } // create a shuffled copy of a vec -fn shuffled(r : rand::rng, v : ~[T]) -> ~[T] { +fn shuffled(r : rand::rng, v : ~[T]) -> ~[T] { let w = vec::to_mut(v); shuffle(r, w); vec::from_mut(w) // Shouldn't this happen automatically? @@ -48,7 +48,7 @@ fn shuffled(r : rand::rng, v : ~[T]) -> ~[T] { // * weighted_choice is O(number of choices) time // * weighted_vec is O(total weight) space type weighted = { weight: uint, item: T }; -fn weighted_choice(r : rand::rng, v : ~[weighted]) -> T { +fn weighted_choice(r : rand::rng, v : ~[weighted]) -> T { assert vec::len(v) != 0u; let total = 0u; for {weight: weight, item: _} in v { @@ -66,7 +66,7 @@ fn weighted_choice(r : rand::rng, v : ~[weighted]) -> T { core::unreachable(); } -fn weighted_vec(v : ~[weighted]) -> ~[T] { +fn weighted_vec(v : ~[weighted]) -> ~[T] { let r = ~[]; for {weight: weight, item: item} in v { let i = 0u; diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index b91cc86eb2630..c783e1d616132 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -294,7 +294,7 @@ pub fn basic_options() -> @options { } // Seems out of place, but it uses session, so I'm putting it here -pub fn expect(sess: Session, +pub fn expect(sess: Session, opt: Option, msg: fn() -> ~str) -> T { diff --git a/src/librustc/front/core_inject.rs b/src/librustc/front/core_inject.rs index 281d1ea730592..51b25854bc751 100644 --- a/src/librustc/front/core_inject.rs +++ b/src/librustc/front/core_inject.rs @@ -37,7 +37,7 @@ fn use_core(crate: @ast::crate) -> bool { fn inject_libcore_ref(sess: Session, crate: @ast::crate) -> @ast::crate { - fn spanned(x: T) -> codemap::spanned { + fn spanned(x: T) -> codemap::spanned { codemap::spanned { node: x, span: dummy_sp() } } diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 1d396983f4e90..757c6233ba444 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -335,7 +335,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item { return @item; } -fn nospan(t: T) -> codemap::spanned { +fn nospan(t: T) -> codemap::spanned { codemap::spanned { node: t, span: dummy_sp() } } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 5343b832de503..86b07abffc2e9 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -969,7 +969,7 @@ fn encode_info_for_items(ecx: @EncodeContext, ebml_w: writer::Encoder, // Path and definition ID indexing -fn create_index(index: ~[entry]) -> +fn create_index(index: ~[entry]) -> ~[@~[entry]] { let mut buckets: ~[@mut ~[entry]] = ~[]; for uint::range(0u, 256u) |_i| { buckets.push(@mut ~[]); }; diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 664a5e861af72..2175d0f074c60 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -78,7 +78,7 @@ pub fn mk_filesearch(maybe_sysroot: Option, } as FileSearch } -pub fn search(filesearch: FileSearch, pick: pick) -> Option { +pub fn search(filesearch: FileSearch, pick: pick) -> Option { let mut rslt = None; for filesearch.lib_search_paths().each |lib_search_path| { debug!("searching %s", lib_search_path.to_str()); diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 9440c951be5e9..71de59391edba 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -248,7 +248,7 @@ trait def_id_encoder_helpers { fn emit_def_id(did: ast::def_id); } -impl def_id_encoder_helpers for S { +impl def_id_encoder_helpers for S { fn emit_def_id(did: ast::def_id) { did.encode(&self) } @@ -258,7 +258,7 @@ trait def_id_decoder_helpers { fn read_def_id(xcx: @ExtendedDecodeContext) -> ast::def_id; } -impl def_id_decoder_helpers for D { +impl def_id_decoder_helpers for D { fn read_def_id(xcx: @ExtendedDecodeContext) -> ast::def_id { let did: ast::def_id = Decodable::decode(&self); @@ -1276,14 +1276,14 @@ fn test_more() { fn test_simplification() { let ext_cx = mk_ctxt(); let item_in = ast::ii_item(quote_item!( - fn new_int_alist() -> alist { + fn new_int_alist() -> alist { fn eq_int(&&a: int, &&b: int) -> bool { a == b } return {eq_fn: eq_int, data: ~[]}; } ).get()); let item_out = simplify_ast(item_in); let item_exp = ast::ii_item(quote_item!( - fn new_int_alist() -> alist { + fn new_int_alist() -> alist { return {eq_fn: eq_int, data: ~[]}; } ).get()); diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 2c72544845728..568bc5b5e70f6 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -491,7 +491,7 @@ pub impl BorrowckCtxt { cat_def(self.tcx, self.method_map, id, span, ty, def) } - fn cat_variant(&self, + fn cat_variant(&self, arg: N, enum_did: ast::def_id, cmt: cmt) -> cmt { diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 61eff69d979e0..a88f478dd4b7e 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -526,7 +526,7 @@ fn check_item_while_true(cx: ty::ctxt, it: @ast::item) { } fn check_item_type_limits(cx: ty::ctxt, it: @ast::item) { - pure fn is_valid(binop: ast::binop, v: T, + pure fn is_valid(binop: ast::binop, v: T, min: T, max: T) -> bool { match binop { ast::lt => v <= max, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 1c48df115e544..0621beb43a3d5 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -263,7 +263,7 @@ pub fn cat_def( return mcx.cat_def(expr_id, expr_span, expr_ty, def); } -pub fn cat_variant( +pub fn cat_variant( tcx: ty::ctxt, method_map: typeck::method_map, arg: N, @@ -292,11 +292,11 @@ pub impl ast_node for @ast::pat { } pub trait get_type_for_node { - fn ty(node: N) -> ty::t; + fn ty(node: N) -> ty::t; } pub impl get_type_for_node for ty::ctxt { - fn ty(node: N) -> ty::t { + fn ty(node: N) -> ty::t { ty::node_id_to_type(self, node.id()) } } @@ -575,7 +575,7 @@ pub impl mem_categorization_ctxt { } } - fn cat_variant(&self, + fn cat_variant(&self, arg: N, enum_did: ast::def_id, cmt: cmt) -> cmt { @@ -589,7 +589,7 @@ pub impl mem_categorization_ctxt { } } - fn cat_rvalue(&self, elt: N, expr_ty: ty::t) -> cmt { + fn cat_rvalue(&self, elt: N, expr_ty: ty::t) -> cmt { @cmt_ { id:elt.id(), span:elt.span(), @@ -739,7 +739,7 @@ pub impl mem_categorization_ctxt { } } - fn cat_index(&self, + fn cat_index(&self, elt: N, base_cmt: cmt) -> cmt { let mt = match ty::index(self.tcx, base_cmt.ty) { @@ -792,7 +792,7 @@ pub impl mem_categorization_ctxt { } }; - fn comp(elt: N, of_cmt: cmt, + fn comp(elt: N, of_cmt: cmt, vect: ty::t, mutbl: MutabilityCategory, mt: ty::mt) -> cmt { @@ -809,7 +809,7 @@ pub impl mem_categorization_ctxt { } } - fn cat_tuple_elt(&self, + fn cat_tuple_elt(&self, elt: N, cmt: cmt) -> cmt { @cmt_ { @@ -822,7 +822,7 @@ pub impl mem_categorization_ctxt { } } - fn cat_anon_struct_field(&self, + fn cat_anon_struct_field(&self, elt: N, cmt: cmt) -> cmt { @cmt_ { diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 641c3e6b0a38d..606f7ce725939 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -170,7 +170,7 @@ enum debug_metadata { retval_metadata(@Metadata), } -fn cast_safely(val: T) -> U { +fn cast_safely(val: T) -> U { unsafe { let val2 = val; return cast::transmute(val2); @@ -192,7 +192,7 @@ fn md_from_metadata(val: debug_metadata) -> T { } } -fn cached_metadata(cache: metadata_cache, +fn cached_metadata(cache: metadata_cache, mdtag: int, eq_fn: fn(md: T) -> bool) -> Option { diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 96107c141bec7..413ec9fcdf389 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -775,7 +775,7 @@ fn mk_rcache() -> creader_cache { return oldmap::HashMap(); } -pub fn new_ty_hash() -> oldmap::HashMap { +pub fn new_ty_hash() -> oldmap::HashMap { oldmap::HashMap() } @@ -3326,7 +3326,7 @@ pub fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) { // Maintains a little union-set tree for inferred modes. `canon()` returns // the current head value for `m0`. -fn canon(tbl: HashMap>, +fn canon(tbl: HashMap>, +m0: ast::inferable) -> ast::inferable { match m0 { ast::infer(id) => match tbl.find(&id) { diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index c04141b259681..9269752b8ecf4 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -94,7 +94,7 @@ pub fn get_region_reporting_err(tcx: ty::ctxt, } } -pub fn ast_region_to_region( +pub fn ast_region_to_region( self: @mut AC, rscope: RS, span: span, @@ -110,7 +110,7 @@ pub fn ast_region_to_region( get_region_reporting_err(self.tcx(), span, res) } -pub fn ast_path_to_substs_and_ty( +pub fn ast_path_to_substs_and_ty( self: @mut AC, rscope: RS, did: ast::def_id, @@ -166,7 +166,7 @@ pub fn ast_path_to_substs_and_ty( ty_param_substs_and_ty { substs: substs, ty: ty } } -pub fn ast_path_to_ty( +pub fn ast_path_to_ty( self: @mut AC, rscope: RS, did: ast::def_id, @@ -192,10 +192,10 @@ pub const NO_TPS: uint = 2; // Parses the programmer's textual representation of a type into our // internal notion of a type. `getter` is a function that returns the type // corresponding to a definition ID: -pub fn ast_ty_to_ty( +pub fn ast_ty_to_ty( self: @mut AC, rscope: RS, &&ast_ty: @ast::Ty) -> ty::t { - fn ast_mt_to_mt( + fn ast_mt_to_mt( self: @mut AC, rscope: RS, mt: ast::mt) -> ty::mt { ty::mt {ty: ast_ty_to_ty(self, rscope, mt.ty), mutbl: mt.mutbl} @@ -204,7 +204,7 @@ pub fn ast_ty_to_ty( // Handle @, ~, and & being able to mean estrs and evecs. // If a_seq_ty is a str or a vec, make it an estr/evec. // Also handle function sigils and first-class trait types. - fn mk_pointer( + fn mk_pointer( self: @mut AC, rscope: RS, a_seq_ty: ast::mt, @@ -420,7 +420,7 @@ pub fn ast_ty_to_ty( return typ; } -pub fn ty_of_arg( +pub fn ty_of_arg( self: @mut AC, rscope: RS, a: ast::arg, @@ -468,7 +468,7 @@ pub fn ty_of_arg( arg {mode: mode, ty: ty} } -pub fn ty_of_bare_fn( +pub fn ty_of_bare_fn( self: @mut AC, rscope: RS, purity: ast::purity, @@ -494,7 +494,7 @@ pub fn ty_of_bare_fn( } } -pub fn ty_of_closure( +pub fn ty_of_closure( self: @mut AC, rscope: RS, sigil: ast::Sigil, diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 16846f6c2d01b..3553caf5c33f7 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -1590,7 +1590,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, // through the `unpack` function. It there is no expected type or // resolution is not possible (e.g., no constraints yet present), just // returns `none`. - fn unpack_expected(fcx: @mut FnCtxt, + fn unpack_expected(fcx: @mut FnCtxt, expected: Option, unpack: fn(&ty::sty) -> Option) -> Option { diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 3f2b5ea56b100..96c76b52181c1 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -115,7 +115,7 @@ pub fn collect_item_types(ccx: @mut CrateCtxt, crate: @ast::crate) { } pub impl @mut CrateCtxt { - fn to_ty(rs: RS, ast_ty: @ast::Ty) + fn to_ty(rs: RS, ast_ty: @ast::Ty) -> ty::t { ast_ty_to_ty(self, rs, ast_ty) } diff --git a/src/librustc/middle/typeck/infer/combine.rs b/src/librustc/middle/typeck/infer/combine.rs index 89719564adaa6..34068a5eb0d43 100644 --- a/src/librustc/middle/typeck/infer/combine.rs +++ b/src/librustc/middle/typeck/infer/combine.rs @@ -290,7 +290,7 @@ pub fn super_self_tys( } } -pub fn super_sigils( +pub fn super_sigils( self: &C, p1: ast::Sigil, p2: ast::Sigil) -> cres { if p1 == p2 { Ok(p1) diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index 0d342e338ec23..3998967dc9842 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -173,7 +173,7 @@ pub impl CombineFields { b_id, a_bounds, b_bounds, node_b.rank) } - fn merge_bnd( + fn merge_bnd( &self, a: &Bound, b: &Bound, @@ -263,7 +263,7 @@ pub impl CombineFields { uok() } - fn bnds( + fn bnds( &self, a: &Bound, b: &Bound) -> ures @@ -329,7 +329,7 @@ pub impl TyLatticeDir for Glb { } } -pub fn super_lattice_tys( +pub fn super_lattice_tys( self: &L, a: ty::t, b: ty::t) -> cres { @@ -485,7 +485,7 @@ pub fn lattice_var_and_t(self: &T, isr: isr_alist) -> ~[RegionVid] { +pub fn var_ids(self: &T, isr: isr_alist) -> ~[RegionVid] { let mut result = ~[]; for list::each(isr) |pair| { match pair.second() { diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 4c6fb721956eb..7d799b7ea2fb6 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -351,7 +351,7 @@ pub fn fixup_err_to_str(f: fixup_err) -> ~str { } } -fn new_ValsAndBindings() -> ValsAndBindings { +fn new_ValsAndBindings() -> ValsAndBindings { ValsAndBindings { vals: oldsmallintmap::mk(), bindings: ~[] @@ -517,7 +517,7 @@ trait CresCompare { fn compare(t: T, f: fn() -> ty::type_err) -> cres; } -impl CresCompare for cres { +impl CresCompare for cres { fn compare(t: T, f: fn() -> ty::type_err) -> cres { do self.chain |s| { if s == t { @@ -533,7 +533,7 @@ pub fn uok() -> ures { Ok(()) } -fn rollback_to( +fn rollback_to( vb: &mut ValsAndBindings, len: uint) { @@ -632,7 +632,7 @@ impl @mut InferCtxt { } } -fn next_simple_var( +fn next_simple_var( +counter: &mut uint, +bindings: &mut ValsAndBindings>) -> uint { diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index 89de219f7f638..0013b417f7a31 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -71,7 +71,7 @@ pub impl InferStr for Bounds { } } -pub impl InferStr for VarValue { +pub impl InferStr for VarValue { fn inf_str(&self, cx: &InferCtxt) -> ~str { match *self { Redirect(ref vid) => fmt!("Redirect(%s)", vid.to_str()), diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index b2aac9192f305..6abf2e5709b1c 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -89,7 +89,7 @@ pub impl InferCtxt { } } - fn set>( + fn set>( &mut self, +vid: V, +new_v: VarValue) { @@ -109,7 +109,7 @@ pub impl InferCtxt { } } - fn unify>( + fn unify>( &mut self, node_a: &Node, node_b: &Node) -> (V, uint) @@ -150,7 +150,7 @@ pub trait SimplyUnifiable { static fn to_type_err(expected_found) -> ty::type_err; } -pub fn mk_err(+a_is_expected: bool, +pub fn mk_err(+a_is_expected: bool, +a_t: T, +b_t: T) -> ures { if a_is_expected { diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index 1fe8b9b51a0c3..05820bed0d036 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -157,7 +157,7 @@ pub enum vtable_origin { vtable_static(ast::def_id, ~[ty::t], vtable_res), /* Dynamic vtable, comes from a parameter that has a bound on it: - fn foo(a: T) -- a's vtable would have a + fn foo(a: T) -- a's vtable would have a vtable_param origin The first uint is the param number (identifying T in the example), diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index 046c2a025beee..d5834af3a574a 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -69,9 +69,10 @@ pub fn bound_self_region(rp: Option) } pub struct anon_rscope { anon: ty::Region, base: region_scope } -pub fn in_anon_rscope(self: RS, r: ty::Region) - -> @anon_rscope { - @anon_rscope { anon: r, base: self as region_scope } +pub fn in_anon_rscope(self: RS, + r: ty::Region) + -> @anon_rscope { + @anon_rscope {anon: r, base: self as region_scope} } pub impl region_scope for @anon_rscope { pure fn anon_region(_span: span) -> Result { @@ -91,7 +92,7 @@ pub struct binding_rscope { anon_bindings: uint, } -pub fn in_binding_rscope(self: RS) +pub fn in_binding_rscope(self: RS) -> @mut binding_rscope { let base = self as region_scope; @mut binding_rscope { base: base, anon_bindings: 0 } diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index 113cce422c474..d03af547af094 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -35,7 +35,7 @@ pub struct Fold { fold_struct: FoldStruct } -impl Clone for Fold { +impl Clone for Fold { fn clone(&self) -> Fold { Fold { ctxt: self.ctxt.clone(), @@ -103,7 +103,7 @@ fn mk_fold( } } -pub fn default_any_fold(ctxt: T) -> Fold { +pub fn default_any_fold(ctxt: T) -> Fold { mk_fold( ctxt, |f, d| default_seq_fold_doc(f, d), @@ -121,7 +121,7 @@ pub fn default_any_fold(ctxt: T) -> Fold { ) } -pub fn default_seq_fold(ctxt: T) -> Fold { +pub fn default_seq_fold(ctxt: T) -> Fold { mk_fold( ctxt, |f, d| default_seq_fold_doc(f, d), @@ -139,7 +139,7 @@ pub fn default_seq_fold(ctxt: T) -> Fold { ) } -pub fn default_par_fold(ctxt: T) -> Fold { +pub fn default_par_fold(ctxt: T) -> Fold { mk_fold( ctxt, |f, d| default_seq_fold_doc(f, d), diff --git a/src/librustdoc/util.rs b/src/librustdoc/util.rs index 3ec9d17c854be..61c02bf684938 100644 --- a/src/librustdoc/util.rs +++ b/src/librustdoc/util.rs @@ -17,6 +17,6 @@ pub struct NominalOp { op: T } -impl Clone for NominalOp { +impl Clone for NominalOp { fn clone(&self) -> NominalOp { copy *self } } diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 66b02ae553c4e..50f40559807ab 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -80,7 +80,7 @@ impl &Condvar { struct ARC { x: SharedMutableState } /// Create an atomically reference counted wrapper. -pub fn ARC(data: T) -> ARC { +pub fn ARC(data: T) -> ARC { ARC { x: unsafe { shared_mutable_state(data) } } } @@ -88,7 +88,7 @@ pub fn ARC(data: T) -> ARC { * Access the underlying data in an atomically reference counted * wrapper. */ -pub fn get(rc: &a/ARC) -> &a/T { +pub fn get(rc: &a/ARC) -> &a/T { unsafe { get_shared_immutable_state(&rc.x) } } @@ -99,7 +99,7 @@ pub fn get(rc: &a/ARC) -> &a/T { * object. However, one of the `arc` objects can be sent to another task, * allowing them to share the underlying data. */ -pub fn clone(rc: &ARC) -> ARC { +pub fn clone(rc: &ARC) -> ARC { ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } } } @@ -112,12 +112,12 @@ pub fn clone(rc: &ARC) -> ARC { * unwrap from a task that holds another reference to the same ARC; it is * guaranteed to deadlock. */ -pub fn unwrap(rc: ARC) -> T { +pub fn unwrap(rc: ARC) -> T { let ARC { x: x } = rc; unsafe { unwrap_shared_mutable_state(x) } } -impl Clone for ARC { +impl Clone for ARC { fn clone(&self) -> ARC { clone(self) } @@ -133,14 +133,14 @@ struct MutexARCInner { lock: Mutex, failed: bool, data: T } struct MutexARC { x: SharedMutableState> } /// Create a mutex-protected ARC with the supplied data. -pub fn MutexARC(user_data: T) -> MutexARC { +pub fn MutexARC(user_data: T) -> MutexARC { mutex_arc_with_condvars(user_data, 1) } /** * Create a mutex-protected ARC with the supplied data and a specified number * of condvars (as sync::mutex_with_condvars). */ -pub fn mutex_arc_with_condvars(user_data: T, +pub fn mutex_arc_with_condvars(user_data: T, num_condvars: uint) -> MutexARC { let data = MutexARCInner { lock: mutex_with_condvars(num_condvars), @@ -148,7 +148,7 @@ pub fn mutex_arc_with_condvars(user_data: T, MutexARC { x: unsafe { shared_mutable_state(data) } } } -impl Clone for MutexARC { +impl Clone for MutexARC { /// Duplicate a mutex-protected ARC, as arc::clone. fn clone(&self) -> MutexARC { // NB: Cloning the underlying mutex is not necessary. Its reference @@ -157,7 +157,7 @@ impl Clone for MutexARC { } } -impl &MutexARC { +impl &MutexARC { /** * Access the underlying mutable data with mutual exclusion from other @@ -219,7 +219,7 @@ impl &MutexARC { * Will additionally fail if another task has failed while accessing the arc. */ // FIXME(#3724) make this a by-move method on the arc -pub fn unwrap_mutex_arc(arc: MutexARC) -> T { +pub fn unwrap_mutex_arc(arc: MutexARC) -> T { let MutexARC { x: x } = arc; let inner = unsafe { unwrap_shared_mutable_state(x) }; let MutexARCInner { failed: failed, data: data, _ } = inner; @@ -283,14 +283,14 @@ struct RWARC { } /// Create a reader/writer ARC with the supplied data. -pub fn RWARC(user_data: T) -> RWARC { +pub fn RWARC(user_data: T) -> RWARC { rw_arc_with_condvars(user_data, 1) } /** * Create a reader/writer ARC with the supplied data and a specified number * of condvars (as sync::rwlock_with_condvars). */ -pub fn rw_arc_with_condvars( +pub fn rw_arc_with_condvars( user_data: T, num_condvars: uint) -> RWARC { @@ -300,7 +300,7 @@ pub fn rw_arc_with_condvars( RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () } } -impl RWARC { +impl RWARC { /// Duplicate a rwlock-protected ARC, as arc::clone. fn clone(&self) -> RWARC { RWARC { x: unsafe { clone_shared_mutable_state(&self.x) }, @@ -309,7 +309,7 @@ impl RWARC { } -impl &RWARC { +impl &RWARC { /** * Access the underlying data mutably. Locks the rwlock in write mode; * other readers and writers will block. @@ -418,7 +418,7 @@ impl &RWARC { * in write mode. */ // FIXME(#3724) make this a by-move method on the arc -pub fn unwrap_rw_arc(arc: RWARC) -> T { +pub fn unwrap_rw_arc(arc: RWARC) -> T { let RWARC { x: x, _ } = arc; let inner = unsafe { unwrap_shared_mutable_state(x) }; let RWARCInner { failed: failed, data: data, _ } = inner; @@ -432,7 +432,7 @@ pub fn unwrap_rw_arc(arc: RWARC) -> T { // lock it. This wraps the unsafety, with the justification that the 'lock' // field is never overwritten; only 'failed' and 'data'. #[doc(hidden)] -fn borrow_rwlock(state: *const RWARCInner) -> *RWlock { +fn borrow_rwlock(state: *const RWARCInner) -> *RWlock { unsafe { cast::transmute(&const (*state).lock) } } @@ -444,7 +444,7 @@ pub enum RWWriteMode = /// The "read permission" token used for RWARC.write_downgrade(). pub enum RWReadMode = (&T, sync::RWlockReadMode); -impl &RWWriteMode { +impl &RWWriteMode { /// Access the pre-downgrade RWARC in write mode. fn write(blk: fn(x: &mut T) -> U) -> U { match *self { @@ -474,7 +474,7 @@ impl &RWWriteMode { } } -impl &RWReadMode { +impl &RWReadMode { /// Access the post-downgrade rwlock in read mode. fn read(blk: fn(x: &T) -> U) -> U { match *self { diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index 696b2753ea44b..5af596c1f84e4 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -120,7 +120,7 @@ pub unsafe fn c_vec_with_dtor(base: *mut T, len: uint, dtor: fn@()) * * Fails if `ofs` is greater or equal to the length of the vector */ -pub fn get(t: CVec, ofs: uint) -> T { +pub fn get(t: CVec, ofs: uint) -> T { assert ofs < len(t); return unsafe { *ptr::mut_offset(t.base, ofs) }; } @@ -130,7 +130,7 @@ pub fn get(t: CVec, ofs: uint) -> T { * * Fails if `ofs` is greater or equal to the length of the vector */ -pub fn set(t: CVec, ofs: uint, v: T) { +pub fn set(t: CVec, ofs: uint, v: T) { assert ofs < len(t); unsafe { *ptr::mut_offset(t.base, ofs) = v }; } diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index c2c21002b195d..9478a39279673 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -25,19 +25,19 @@ pub struct DuplexStream { priv port: Port, } -impl GenericChan for DuplexStream { +impl GenericChan for DuplexStream { fn send(x: T) { self.chan.send(x) } } -impl GenericSmartChan for DuplexStream { +impl GenericSmartChan for DuplexStream { fn try_send(x: T) -> bool { self.chan.try_send(x) } } -impl GenericPort for DuplexStream { +impl GenericPort for DuplexStream { fn recv() -> U { self.port.recv() } @@ -47,20 +47,20 @@ impl GenericPort for DuplexStream { } } -impl Peekable for DuplexStream { +impl Peekable for DuplexStream { pure fn peek() -> bool { self.port.peek() } } -impl Selectable for DuplexStream { +impl Selectable for DuplexStream { pure fn header() -> *pipes::PacketHeader { self.port.header() } } /// Creates a bidirectional stream. -pub fn DuplexStream() +pub fn DuplexStream() -> (DuplexStream, DuplexStream) { let (p1, c2) = pipes::stream(); diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index b1285dac9f401..0ac76cefd6b36 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -198,7 +198,7 @@ mod tests { assert *deq.get(3) == d; } - fn test_parameterized(a: T, b: T, c: T, d: T) { + fn test_parameterized(a: T, b: T, c: T, d: T) { let mut deq = Deque::new(); assert deq.len() == 0; deq.add_front(a); diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index cff30587607f5..f97e5ee680067 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -129,7 +129,7 @@ pub mod serial { } /// Create a `FlatPort` from a `Port<~[u8]>` - pub fn pipe_port>( + pub fn pipe_port>( port: Port<~[u8]> ) -> PipePort { let unflat: DeserializingUnflattener = @@ -140,7 +140,7 @@ pub mod serial { } /// Create a `FlatChan` from a `Chan<~[u8]>` - pub fn pipe_chan>( + pub fn pipe_chan>( chan: Chan<~[u8]> ) -> PipeChan { let flat: SerializingFlattener = @@ -189,7 +189,7 @@ pub mod pod { pub type PipeChan = FlatChan, PipeByteChan>; /// Create a `FlatPort` from a `Reader` - pub fn reader_port( + pub fn reader_port( reader: R ) -> ReaderPort { let unflat: PodUnflattener = PodUnflattener::new(); @@ -198,7 +198,7 @@ pub mod pod { } /// Create a `FlatChan` from a `Writer` - pub fn writer_chan( + pub fn writer_chan( writer: W ) -> WriterChan { let flat: PodFlattener = PodFlattener::new(); @@ -207,21 +207,21 @@ pub mod pod { } /// Create a `FlatPort` from a `Port<~[u8]>` - pub fn pipe_port(port: Port<~[u8]>) -> PipePort { + pub fn pipe_port(port: Port<~[u8]>) -> PipePort { let unflat: PodUnflattener = PodUnflattener::new(); let byte_port = PipeBytePort::new(port); FlatPort::new(unflat, byte_port) } /// Create a `FlatChan` from a `Chan<~[u8]>` - pub fn pipe_chan(chan: Chan<~[u8]>) -> PipeChan { + pub fn pipe_chan(chan: Chan<~[u8]>) -> PipeChan { let flat: PodFlattener = PodFlattener::new(); let byte_chan = PipeByteChan::new(chan); FlatChan::new(flat, byte_chan) } /// Create a pair of `FlatChan` and `FlatPort`, backed by pipes - pub fn pipe_stream() -> (PipePort, PipeChan) { + pub fn pipe_stream() -> (PipePort, PipeChan) { let (port, chan) = pipes::stream(); return (pipe_port(port), pipe_chan(chan)); } @@ -358,7 +358,7 @@ pub mod flatteners { bogus: () } - pub impl Unflattener for PodUnflattener { + pub impl Unflattener for PodUnflattener { fn unflatten(&self, buf: ~[u8]) -> T { assert size_of::() != 0; assert size_of::() == buf.len(); @@ -368,7 +368,7 @@ pub mod flatteners { } } - pub impl Flattener for PodFlattener { + pub impl Flattener for PodFlattener { fn flatten(&self, val: T) -> ~[u8] { assert size_of::() != 0; let val: *T = ptr::to_unsafe_ptr(&val); @@ -377,7 +377,7 @@ pub mod flatteners { } } - pub impl PodUnflattener { + pub impl PodUnflattener { static fn new() -> PodUnflattener { PodUnflattener { bogus: () @@ -385,7 +385,7 @@ pub mod flatteners { } } - pub impl PodFlattener { + pub impl PodFlattener { static fn new() -> PodFlattener { PodFlattener { bogus: () @@ -406,21 +406,21 @@ pub mod flatteners { serialize_value: SerializeValue } - pub impl> Unflattener + pub impl> Unflattener for DeserializingUnflattener { fn unflatten(&self, buf: ~[u8]) -> T { (self.deserialize_buffer)(buf) } } - pub impl> Flattener + pub impl> Flattener for SerializingFlattener { fn flatten(&self, val: T) -> ~[u8] { (self.serialize_value)(&val) } } - pub impl> DeserializingUnflattener { + pub impl> DeserializingUnflattener { static fn new(deserialize_buffer: DeserializeBuffer) -> DeserializingUnflattener { DeserializingUnflattener { @@ -429,7 +429,7 @@ pub mod flatteners { } } - pub impl> SerializingFlattener { + pub impl> SerializingFlattener { static fn new(serialize_value: SerializeValue) -> SerializingFlattener { SerializingFlattener { @@ -519,7 +519,7 @@ pub mod bytepipes { writer: W } - pub impl BytePort for ReaderBytePort { + pub impl BytePort for ReaderBytePort { fn try_recv(&self, count: uint) -> Option<~[u8]> { let mut left = count; let mut bytes = ~[]; @@ -541,13 +541,13 @@ pub mod bytepipes { } } - pub impl ByteChan for WriterByteChan { + pub impl ByteChan for WriterByteChan { fn send(&self, val: ~[u8]) { self.writer.write(val); } } - pub impl ReaderBytePort { + pub impl ReaderBytePort { static fn new(r: R) -> ReaderBytePort { ReaderBytePort { reader: r @@ -555,7 +555,7 @@ pub mod bytepipes { } } - pub impl WriterByteChan { + pub impl WriterByteChan { static fn new(w: W) -> WriterByteChan { WriterByteChan { writer: w @@ -765,7 +765,7 @@ mod test { type WriterChanFactory = ~fn(TcpSocketBuf) -> FlatChan>; - fn test_some_tcp_stream, F: Flattener>( + fn test_some_tcp_stream,F:Flattener>( reader_port: ReaderPortFactory, writer_chan: WriterChanFactory, port: uint) { @@ -901,7 +901,7 @@ mod test { pod::pipe_port(port) } - fn test_try_recv_none1(loader: PortLoader

) { + fn test_try_recv_none1(loader: PortLoader

) { let bytes = ~[]; let port = loader(bytes); let res: Option = port.try_recv(); @@ -917,7 +917,7 @@ mod test { test_try_recv_none1(pipe_port_loader); } - fn test_try_recv_none2(loader: PortLoader

) { + fn test_try_recv_none2(loader: PortLoader

) { // The control word in the protocol is interrupted let bytes = ~[0]; let port = loader(bytes); @@ -934,7 +934,7 @@ mod test { test_try_recv_none2(pipe_port_loader); } - fn test_try_recv_none3(loader: PortLoader

) { + fn test_try_recv_none3(loader: PortLoader

) { const CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD]; // The control word is followed by garbage let bytes = CONTINUE.to_vec() + ~[0]; @@ -952,7 +952,7 @@ mod test { test_try_recv_none3(pipe_port_loader); } - fn test_try_recv_none4(+loader: PortLoader

) { + fn test_try_recv_none4(+loader: PortLoader

) { assert do task::try || { const CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD]; // The control word is followed by a valid length, diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 8af2f350e51f7..0729987958a06 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -34,7 +34,7 @@ enum TreeNode { pub fn init() -> Treemap { @Empty } /// Insert a value into the map -pub fn insert(m: Treemap, k: K, v: V) +pub fn insert(m: Treemap, k: K, v: V) -> Treemap { @match m { @Empty => Node(@k, @v, @Empty, @Empty), @@ -49,7 +49,7 @@ pub fn insert(m: Treemap, k: K, v: V) } /// Find a value based on the key -pub fn find(m: Treemap, k: K) -> Option { +pub fn find(m: Treemap, k: K) -> Option { match *m { Empty => None, Node(@ref kk, @copy v, left, right) => { diff --git a/src/libstd/json.rs b/src/libstd/json.rs index e8278bb1b3563..8d0daa323ad7c 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -323,7 +323,7 @@ pub impl serialize::Encoder for PrettyEncoder { } } -pub impl serialize::Encodable for Json { +pub impl serialize::Encodable for Json { fn encode(&self, s: &S) { match *self { Number(v) => v.encode(s), @@ -1150,7 +1150,7 @@ impl ToJson for @~str { fn to_json() -> Json { String(copy *self) } } -impl ToJson for (A, B) { +impl ToJson for (A, B) { fn to_json() -> Json { match self { (ref a, ref b) => { @@ -1160,7 +1160,7 @@ impl ToJson for (A, B) { } } -impl ToJson for (A, B, C) { +impl ToJson for (A, B, C) { fn to_json() -> Json { match self { (ref a, ref b, ref c) => { @@ -1170,11 +1170,11 @@ impl ToJson for (A, B, C) { } } -impl ToJson for ~[A] { +impl ToJson for ~[A] { fn to_json() -> Json { List(self.map(|elt| elt.to_json())) } } -impl ToJson for LinearMap<~str, A> { +impl ToJson for LinearMap<~str, A> { fn to_json() -> Json { let mut d = LinearMap::new(); for self.each |&(key, value)| { @@ -1184,7 +1184,7 @@ impl ToJson for LinearMap<~str, A> { } } -impl ToJson for Option { +impl ToJson for Option { fn to_json() -> Json { match self { None => Null, @@ -1282,13 +1282,13 @@ mod tests { // two fns copied from libsyntax/util/testing.rs. // Should they be in their own crate? - pub pure fn check_equal_ptr (given : &T, expected: &T) { + pub pure fn check_equal_ptr (given : &T, expected: &T) { if !((given == expected) && (expected == given )) { fail!(fmt!("given %?, expected %?",given,expected)); } } - pub pure fn check_equal (given : T, expected: T) { + pub pure fn check_equal (given : T, expected: T) { if !((given == expected) && (expected == given )) { fail!(fmt!("given %?, expected %?",given,expected)); } diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 5feac4ad454cd..f6cbd9a099b6a 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -23,7 +23,7 @@ pub enum List { } /// Create a list from a vector -pub pure fn from_vec(v: &[T]) -> @List { +pub pure fn from_vec(v: &[T]) -> @List { vec::foldr(v, @Nil::, |h, t| @Cons(*h, t)) } @@ -40,7 +40,7 @@ pub pure fn from_vec(v: &[T]) -> @List { * * z - The initial value * * f - The function to apply */ -pub fn foldl(z: T, ls: @List, f: fn(&T, &U) -> T) -> T { +pub fn foldl(z: T, ls: @List, f: fn(&T, &U) -> T) -> T { let mut accum: T = z; do iter(ls) |elt| { accum = f(&accum, elt);} accum @@ -53,7 +53,7 @@ pub fn foldl(z: T, ls: @List, f: fn(&T, &U) -> T) -> T { * When function `f` returns true then an option containing the element * is returned. If `f` matches no elements then none is returned. */ -pub pure fn find(ls: @List, f: fn(&T) -> bool) -> Option { +pub pure fn find(ls: @List, f: fn(&T) -> bool) -> Option { let mut ls = ls; loop { ls = match *ls { @@ -67,7 +67,7 @@ pub pure fn find(ls: @List, f: fn(&T) -> bool) -> Option { } /// Returns true if a list contains an element with the given value -pub fn has(ls: @List, elt: T) -> bool { +pub fn has(ls: @List, elt: T) -> bool { for each(ls) |e| { if *e == elt { return true; } } @@ -75,7 +75,7 @@ pub fn has(ls: @List, elt: T) -> bool { } /// Returns true if the list is empty -pub pure fn is_empty(ls: @List) -> bool { +pub pure fn is_empty(ls: @List) -> bool { match *ls { Nil => true, _ => false @@ -90,7 +90,7 @@ pub pure fn len(ls: @List) -> uint { } /// Returns all but the first element of a list -pub pure fn tail(ls: @List) -> @List { +pub pure fn tail(ls: @List) -> @List { match *ls { Cons(_, tl) => return tl, Nil => fail!(~"list empty") @@ -98,7 +98,7 @@ pub pure fn tail(ls: @List) -> @List { } /// Returns the first element of a list -pub pure fn head(ls: @List) -> T { +pub pure fn head(ls: @List) -> T { match *ls { Cons(copy hd, _) => hd, // makes me sad @@ -107,7 +107,7 @@ pub pure fn head(ls: @List) -> T { } /// Appends one list to another -pub pure fn append(l: @List, m: @List) -> @List { +pub pure fn append(l: @List, m: @List) -> @List { match *l { Nil => return m, Cons(copy x, xs) => { @@ -120,7 +120,7 @@ pub pure fn append(l: @List, m: @List) -> @List { /* /// Push one element into the front of a list, returning a new list /// THIS VERSION DOESN'T ACTUALLY WORK -pure fn push(ll: &mut @list, vv: T) { +pure fn push(ll: &mut @list, vv: T) { ll = &mut @cons(vv, *ll) } */ diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs index 701268e044ae3..53692cd3be570 100644 --- a/src/libstd/oldmap.rs +++ b/src/libstd/oldmap.rs @@ -76,7 +76,7 @@ pub mod chained { FoundAfter(@Entry, @Entry) } - priv impl T { + priv impl T { pure fn search_rem(k: &K, h: uint, idx: uint, e_root: @Entry) -> SearchResult { let mut e0 = e_root; @@ -156,19 +156,19 @@ pub mod chained { } } - impl Container for T { + impl Container for T { pure fn len(&self) -> uint { self.count } pure fn is_empty(&self) -> bool { self.count == 0 } } - impl Mutable for T { + impl Mutable for T { fn clear(&mut self) { self.count = 0u; self.chains = chains(initial_capacity); } } - impl T { + impl T { pure fn contains_key(&self, k: &K) -> bool { let hash = k.hash_keyed(0,0) as uint; match self.search_tbl(k, hash) { @@ -252,7 +252,7 @@ pub mod chained { } } - impl T { + impl T { pure fn find(&self, k: &K) -> Option { match self.search_tbl(k, k.hash_keyed(0,0) as uint) { NotFound => None, @@ -325,7 +325,7 @@ pub mod chained { } } - impl T { + impl T { fn to_writer(wr: io::Writer) { if self.count == 0u { wr.write_str(~"{}"); @@ -347,7 +347,8 @@ pub mod chained { } } - impl ToStr for T { + impl ToStr + for T { pure fn to_str(&self) -> ~str { unsafe { // Meh -- this should be safe @@ -356,7 +357,7 @@ pub mod chained { } } - impl ops::Index for T { + impl ops::Index for T { pure fn index(&self, k: K) -> V { self.get(&k) } @@ -366,7 +367,7 @@ pub mod chained { vec::from_elem(nchains, None) } - pub fn mk() -> T { + pub fn mk() -> T { let slf: T = @HashMap_ {count: 0u, chains: chains(initial_capacity)}; slf @@ -378,18 +379,19 @@ Function: hashmap Construct a hashmap. */ -pub fn HashMap() +pub fn HashMap() -> HashMap { chained::mk() } /// Convenience function for adding keys to a hashmap with nil type keys -pub fn set_add(set: Set, key: K) -> bool { +pub fn set_add(set: Set, key: K) + -> bool { set.insert(key, ()) } /// Convert a set into a vector. -pub pure fn vec_from_set(s: Set) -> ~[T] { +pub pure fn vec_from_set(s: Set) -> ~[T] { do vec::build_sized(s.len()) |push| { for s.each_key() |&k| { push(k); @@ -398,7 +400,7 @@ pub pure fn vec_from_set(s: Set) -> ~[T] { } /// Construct a hashmap from a vector -pub fn hash_from_vec( +pub fn hash_from_vec( items: &[(K, V)]) -> HashMap { let map = HashMap(); for vec::each(items) |item| { diff --git a/src/libstd/oldsmallintmap.rs b/src/libstd/oldsmallintmap.rs index c4ba465acea94..a31309d7980dc 100644 --- a/src/libstd/oldsmallintmap.rs +++ b/src/libstd/oldsmallintmap.rs @@ -32,7 +32,7 @@ pub enum SmallIntMap { } /// Create a smallintmap -pub fn mk() -> SmallIntMap { +pub fn mk() -> SmallIntMap { let v = DVec(); SmallIntMap_(@SmallIntMap_ { v: v } ) } @@ -42,7 +42,7 @@ pub fn mk() -> SmallIntMap { * the specified key then the original value is replaced. */ #[inline(always)] -pub fn insert(self: SmallIntMap, key: uint, val: T) { +pub fn insert(self: SmallIntMap, key: uint, val: T) { //io::println(fmt!("%?", key)); self.v.grow_set_elt(key, &None, Some(val)); } @@ -51,7 +51,7 @@ pub fn insert(self: SmallIntMap, key: uint, val: T) { * Get the value for the specified key. If the key does not exist * in the map then returns none */ -pub pure fn find(self: SmallIntMap, key: uint) -> Option { +pub pure fn find(self: SmallIntMap, key: uint) -> Option { if key < self.v.len() { return self.v.get_elt(key); } return None::; } @@ -63,7 +63,7 @@ pub pure fn find(self: SmallIntMap, key: uint) -> Option { * * If the key does not exist in the map */ -pub pure fn get(self: SmallIntMap, key: uint) -> T { +pub pure fn get(self: SmallIntMap, key: uint) -> T { match find(self, key) { None => { error!("smallintmap::get(): key not present"); @@ -74,7 +74,7 @@ pub pure fn get(self: SmallIntMap, key: uint) -> T { } /// Returns true if the map contains a value for the specified key -pub pure fn contains_key(self: SmallIntMap, key: uint) -> bool { +pub pure fn contains_key(self: SmallIntMap, key: uint) -> bool { return !find(self, key).is_none(); } @@ -100,7 +100,7 @@ impl Mutable for SmallIntMap { } /// Implements the map::map interface for smallintmap -impl SmallIntMap { +impl SmallIntMap { #[inline(always)] fn insert(key: uint, value: V) -> bool { let exists = contains_key(self, key); @@ -162,7 +162,7 @@ impl SmallIntMap { } } -impl ops::Index for SmallIntMap { +impl ops::Index for SmallIntMap { pure fn index(&self, key: uint) -> V { unsafe { get(*self, key) diff --git a/src/libstd/par.rs b/src/libstd/par.rs index c48f56dd143bb..0839ce1812355 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -34,7 +34,7 @@ const min_granularity : uint = 1024u; * This is used to build most of the other parallel vector functions, * like map or alli. */ -fn map_slices( +fn map_slices( xs: &[A], f: &fn() -> ~fn(uint, v: &[A]) -> B) -> ~[B] { @@ -90,7 +90,7 @@ fn map_slices( } /// A parallel version of map. -pub fn map( +pub fn map( xs: &[A], fn_factory: &fn() -> ~fn(&A) -> B) -> ~[B] { vec::concat(map_slices(xs, || { let f = fn_factory(); @@ -101,7 +101,7 @@ pub fn map( } /// A parallel version of mapi. -pub fn mapi( +pub fn mapi( xs: &[A], fn_factory: &fn() -> ~fn(uint, &A) -> B) -> ~[B] { @@ -120,7 +120,7 @@ pub fn mapi( } /// Returns true if the function holds for all elements in the vector. -pub fn alli( +pub fn alli( xs: &[A], fn_factory: &fn() -> ~fn(uint, &A) -> bool) -> bool { @@ -135,7 +135,7 @@ pub fn alli( } /// Returns true if the function holds for any elements in the vector. -pub fn any( +pub fn any( xs: &[A], fn_factory: &fn() -> ~fn(&A) -> bool) -> bool { do vec::any(map_slices(xs, || { diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs index b216834a20500..f642bf52f659a 100644 --- a/src/libstd/priority_queue.rs +++ b/src/libstd/priority_queue.rs @@ -27,7 +27,7 @@ pub struct PriorityQueue { priv data: ~[T], } -impl BaseIter for PriorityQueue { +impl BaseIter for PriorityQueue { /// Visit all values in the underlying vector. /// /// The values are **not** visited in order. @@ -35,7 +35,7 @@ impl BaseIter for PriorityQueue { pure fn size_hint(&self) -> Option { self.data.size_hint() } } -impl Container for PriorityQueue { +impl Container for PriorityQueue { /// Returns the length of the queue pure fn len(&self) -> uint { self.data.len() } @@ -43,12 +43,12 @@ impl Container for PriorityQueue { pure fn is_empty(&self) -> bool { self.data.is_empty() } } -impl Mutable for PriorityQueue { +impl Mutable for PriorityQueue { /// Drop all items from the queue fn clear(&mut self) { self.data.truncate(0) } } -impl PriorityQueue { +impl PriorityQueue { /// Returns the greatest item in the queue - fails if empty pure fn top(&self) -> &self/T { &self.data[0] } diff --git a/src/libstd/semver.rs b/src/libstd/semver.rs index 97c60330a7e31..5f96687127cad 100644 --- a/src/libstd/semver.rs +++ b/src/libstd/semver.rs @@ -392,4 +392,4 @@ fn test_spec_order() { assert a < b; i += 1; } -} \ No newline at end of file +} diff --git a/src/libstd/serialize.rs b/src/libstd/serialize.rs index 9b7cf8adce553..3178e141097f9 100644 --- a/src/libstd/serialize.rs +++ b/src/libstd/serialize.rs @@ -105,218 +105,218 @@ pub trait Decoder { fn read_tup_elt(&self, idx: uint, f: fn() -> T) -> T; } -pub trait Encodable { +pub trait Encodable { fn encode(&self, s: &S); } -pub trait Decodable { +pub trait Decodable { static fn decode(&self, d: &D) -> Self; } -pub impl Encodable for uint { +pub impl Encodable for uint { fn encode(&self, s: &S) { s.emit_uint(*self) } } -pub impl Decodable for uint { +pub impl Decodable for uint { static fn decode(&self, d: &D) -> uint { d.read_uint() } } -pub impl Encodable for u8 { +pub impl Encodable for u8 { fn encode(&self, s: &S) { s.emit_u8(*self) } } -pub impl Decodable for u8 { +pub impl Decodable for u8 { static fn decode(&self, d: &D) -> u8 { d.read_u8() } } -pub impl Encodable for u16 { +pub impl Encodable for u16 { fn encode(&self, s: &S) { s.emit_u16(*self) } } -pub impl Decodable for u16 { +pub impl Decodable for u16 { static fn decode(&self, d: &D) -> u16 { d.read_u16() } } -pub impl Encodable for u32 { +pub impl Encodable for u32 { fn encode(&self, s: &S) { s.emit_u32(*self) } } -pub impl Decodable for u32 { +pub impl Decodable for u32 { static fn decode(&self, d: &D) -> u32 { d.read_u32() } } -pub impl Encodable for u64 { +pub impl Encodable for u64 { fn encode(&self, s: &S) { s.emit_u64(*self) } } -pub impl Decodable for u64 { +pub impl Decodable for u64 { static fn decode(&self, d: &D) -> u64 { d.read_u64() } } -pub impl Encodable for int { +pub impl Encodable for int { fn encode(&self, s: &S) { s.emit_int(*self) } } -pub impl Decodable for int { +pub impl Decodable for int { static fn decode(&self, d: &D) -> int { d.read_int() } } -pub impl Encodable for i8 { +pub impl Encodable for i8 { fn encode(&self, s: &S) { s.emit_i8(*self) } } -pub impl Decodable for i8 { +pub impl Decodable for i8 { static fn decode(&self, d: &D) -> i8 { d.read_i8() } } -pub impl Encodable for i16 { +pub impl Encodable for i16 { fn encode(&self, s: &S) { s.emit_i16(*self) } } -pub impl Decodable for i16 { +pub impl Decodable for i16 { static fn decode(&self, d: &D) -> i16 { d.read_i16() } } -pub impl Encodable for i32 { +pub impl Encodable for i32 { fn encode(&self, s: &S) { s.emit_i32(*self) } } -pub impl Decodable for i32 { +pub impl Decodable for i32 { static fn decode(&self, d: &D) -> i32 { d.read_i32() } } -pub impl Encodable for i64 { +pub impl Encodable for i64 { fn encode(&self, s: &S) { s.emit_i64(*self) } } -pub impl Decodable for i64 { +pub impl Decodable for i64 { static fn decode(&self, d: &D) -> i64 { d.read_i64() } } -pub impl Encodable for &str { +pub impl Encodable for &str { fn encode(&self, s: &S) { s.emit_borrowed_str(*self) } } -pub impl Encodable for ~str { +pub impl Encodable for ~str { fn encode(&self, s: &S) { s.emit_owned_str(*self) } } -pub impl Decodable for ~str { +pub impl Decodable for ~str { static fn decode(&self, d: &D) -> ~str { d.read_owned_str() } } -pub impl Encodable for @str { +pub impl Encodable for @str { fn encode(&self, s: &S) { s.emit_managed_str(*self) } } -pub impl Decodable for @str { +pub impl Decodable for @str { static fn decode(&self, d: &D) -> @str { d.read_managed_str() } } -pub impl Encodable for float { +pub impl Encodable for float { fn encode(&self, s: &S) { s.emit_float(*self) } } -pub impl Decodable for float { +pub impl Decodable for float { static fn decode(&self, d: &D) -> float { d.read_float() } } -pub impl Encodable for f32 { +pub impl Encodable for f32 { fn encode(&self, s: &S) { s.emit_f32(*self) } } -pub impl Decodable for f32 { +pub impl Decodable for f32 { static fn decode(&self, d: &D) -> f32 { d.read_f32() } } -pub impl Encodable for f64 { +pub impl Encodable for f64 { fn encode(&self, s: &S) { s.emit_f64(*self) } } -pub impl Decodable for f64 { +pub impl Decodable for f64 { static fn decode(&self, d: &D) -> f64 { d.read_f64() } } -pub impl Encodable for bool { +pub impl Encodable for bool { fn encode(&self, s: &S) { s.emit_bool(*self) } } -pub impl Decodable for bool { +pub impl Decodable for bool { static fn decode(&self, d: &D) -> bool { d.read_bool() } } -pub impl Encodable for () { +pub impl Encodable for () { fn encode(&self, s: &S) { s.emit_nil() } } -pub impl Decodable for () { +pub impl Decodable for () { static fn decode(&self, d: &D) -> () { d.read_nil() } } -pub impl> Encodable for &T { +pub impl> Encodable for &T { fn encode(&self, s: &S) { s.emit_borrowed(|| (**self).encode(s)) } } -pub impl> Encodable for ~T { +pub impl> Encodable for ~T { fn encode(&self, s: &S) { s.emit_owned(|| (**self).encode(s)) } } -pub impl> Decodable for ~T { +pub impl> Decodable for ~T { static fn decode(&self, d: &D) -> ~T { d.read_owned(|| ~Decodable::decode(d)) } } -pub impl> Encodable for @T { +pub impl> Encodable for @T { fn encode(&self, s: &S) { s.emit_managed(|| (**self).encode(s)) } } -pub impl> Decodable for @T { +pub impl> Decodable for @T { static fn decode(&self, d: &D) -> @T { d.read_managed(|| @Decodable::decode(d)) } } -pub impl> Encodable for &[T] { +pub impl> Encodable for &[T] { fn encode(&self, s: &S) { do s.emit_borrowed_vec(self.len()) { for self.eachi |i, e| { @@ -326,7 +326,7 @@ pub impl> Encodable for &[T] { } } -pub impl> Encodable for ~[T] { +pub impl> Encodable for ~[T] { fn encode(&self, s: &S) { do s.emit_owned_vec(self.len()) { for self.eachi |i, e| { @@ -336,7 +336,7 @@ pub impl> Encodable for ~[T] { } } -pub impl> Decodable for ~[T] { +pub impl> Decodable for ~[T] { static fn decode(&self, d: &D) -> ~[T] { do d.read_owned_vec |len| { do vec::from_fn(len) |i| { @@ -346,7 +346,7 @@ pub impl> Decodable for ~[T] { } } -pub impl> Encodable for @[T] { +pub impl> Encodable for @[T] { fn encode(&self, s: &S) { do s.emit_managed_vec(self.len()) { for self.eachi |i, e| { @@ -356,7 +356,7 @@ pub impl> Encodable for @[T] { } } -pub impl> Decodable for @[T] { +pub impl> Decodable for @[T] { static fn decode(&self, d: &D) -> @[T] { do d.read_managed_vec |len| { do at_vec::from_fn(len) |i| { @@ -366,7 +366,7 @@ pub impl> Decodable for @[T] { } } -pub impl> Encodable for Option { +pub impl> Encodable for Option { fn encode(&self, s: &S) { do s.emit_enum(~"option") { match *self { @@ -381,7 +381,7 @@ pub impl> Encodable for Option { } } -pub impl> Decodable for Option { +pub impl> Decodable for Option { static fn decode(&self, d: &D) -> Option { do d.read_enum(~"option") { do d.read_enum_variant |i| { @@ -396,7 +396,7 @@ pub impl> Decodable for Option { } } -pub impl, T1: Encodable> Encodable +pub impl,T1:Encodable> Encodable for (T0, T1) { fn encode(&self, s: &S) { match *self { @@ -410,7 +410,7 @@ pub impl, T1: Encodable> Encodable } } -pub impl, T1: Decodable> Decodable +pub impl,T1:Decodable> Decodable for (T0, T1) { static fn decode(&self, d: &D) -> (T0, T1) { do d.read_tup(2) { @@ -552,7 +552,7 @@ pub trait EncoderHelpers { fn emit_from_vec(&self, v: &[T], f: fn(v: &T)); } -pub impl EncoderHelpers for S { +pub impl EncoderHelpers for S { fn emit_from_vec(&self, v: &[T], f: fn(v: &T)) { do self.emit_owned_vec(v.len()) { for v.eachi |i, e| { @@ -568,7 +568,7 @@ pub trait DecoderHelpers { fn read_to_vec(&self, f: fn() -> T) -> ~[T]; } -pub impl DecoderHelpers for D { +pub impl DecoderHelpers for D { fn read_to_vec(&self, f: fn() -> T) -> ~[T] { do self.read_owned_vec |len| { do vec::from_fn(len) |i| { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 382cd658663dc..68d22f7c919a6 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -131,7 +131,7 @@ pub impl SmallIntMap { } } -pub impl SmallIntMap { +pub impl SmallIntMap { fn update_with_key(&mut self, key: uint, val: V, ff: fn(uint, V, V) -> V) -> bool { let new_val = match self.find(&key) { diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 3450205aa9569..d2515df3e1b40 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -25,12 +25,12 @@ type Le = pure fn(v1: &T, v2: &T) -> bool; * Has worst case O(n log n) performance, best case O(n), but * is not space efficient. This is a stable sort. */ -pub pure fn merge_sort(v: &[const T], le: Le) -> ~[T] { +pub pure fn merge_sort(v: &[const T], le: Le) -> ~[T] { type Slice = (uint, uint); unsafe {return merge_sort_(v, (0u, len(v)), le);} - fn merge_sort_(v: &[const T], slice: Slice, le: Le) + fn merge_sort_(v: &[const T], slice: Slice, le: Le) -> ~[T] { let begin = slice.first(); let end = slice.second(); @@ -45,7 +45,7 @@ pub pure fn merge_sort(v: &[const T], le: Le) -> ~[T] { return merge(le, merge_sort_(v, a, le), merge_sort_(v, b, le)); } - fn merge(le: Le, a: &[T], b: &[T]) -> ~[T] { + fn merge(le: Le, a: &[T], b: &[T]) -> ~[T] { let mut rs = vec::with_capacity(len(a) + len(b)); let a_len = len(a); let mut a_ix = 0; @@ -103,7 +103,7 @@ pub fn quick_sort(arr: &mut [T], compare_func: Le) { qsort::(arr, 0u, len::(arr) - 1u, compare_func); } -fn qsort3(arr: &mut [T], left: int, right: int) { +fn qsort3(arr: &mut [T], left: int, right: int) { if right <= left { return; } let v: T = arr[right]; let mut i: int = left - 1; @@ -160,7 +160,7 @@ fn qsort3(arr: &mut [T], left: int, right: int) { * * This is an unstable sort. */ -pub fn quick_sort3(arr: &mut [T]) { +pub fn quick_sort3(arr: &mut [T]) { if arr.len() <= 1 { return; } qsort3(arr, 0, (arr.len() - 1) as int); } @@ -169,7 +169,7 @@ pub trait Sort { fn qsort(self); } -impl Sort for &mut [T] { +impl Sort for &mut [T] { fn qsort(self) { quick_sort3(self); } } @@ -177,7 +177,7 @@ const MIN_MERGE: uint = 64; const MIN_GALLOP: uint = 7; const INITIAL_TMP_STORAGE: uint = 128; -pub fn tim_sort(array: &mut [T]) { +pub fn tim_sort(array: &mut [T]) { let size = array.len(); if size < 2 { return; @@ -216,7 +216,7 @@ pub fn tim_sort(array: &mut [T]) { ms.merge_force_collapse(array); } -fn binarysort(array: &mut [T], start: uint) { +fn binarysort(array: &mut [T], start: uint) { let size = array.len(); let mut start = start; assert start <= size; @@ -266,7 +266,7 @@ pure fn min_run_length(n: uint) -> uint { return n + r; } -fn count_run_ascending(array: &mut [T]) -> uint { +fn count_run_ascending(array: &mut [T]) -> uint { let size = array.len(); assert size > 0; if size == 1 { return 1; } @@ -286,7 +286,7 @@ fn count_run_ascending(array: &mut [T]) -> uint { return run; } -pure fn gallop_left(key: &const T, array: &[const T], +pure fn gallop_left(key: &const T, array: &[const T], hint: uint) -> uint { let size = array.len(); assert size != 0 && hint < size; @@ -335,7 +335,7 @@ pure fn gallop_left(key: &const T, array: &[const T], return ofs; } -pure fn gallop_right(key: &const T, array: &[const T], +pure fn gallop_right(key: &const T, array: &[const T], hint: uint) -> uint { let size = array.len(); assert size != 0 && hint < size; @@ -404,7 +404,7 @@ fn MergeState() -> MergeState { } } -impl MergeState { +impl MergeState { fn push_run(&self, run_base: uint, run_len: uint) { let tmp = RunState{base: run_base, len: run_len}; self.runs.push(tmp); @@ -708,7 +708,7 @@ impl MergeState { } #[inline(always)] -fn copy_vec(dest: &mut [T], s1: uint, +fn copy_vec(dest: &mut [T], s1: uint, from: &[const T], s2: uint, len: uint) { assert s1+len <= dest.len() && s2+len <= from.len(); @@ -1019,7 +1019,7 @@ mod big_tests { tabulate_managed(low, high); } - fn multiplyVec(arr: &[const T], num: uint) -> ~[T] { + fn multiplyVec(arr: &[const T], num: uint) -> ~[T] { let size = arr.len(); let res = do vec::from_fn(num) |i| { arr[i % size] @@ -1035,7 +1035,7 @@ mod big_tests { } fn tabulate_unique(lo: uint, hi: uint) { - fn isSorted(arr: &[const T]) { + fn isSorted(arr: &[const T]) { for uint::range(0, arr.len()-1) |i| { if arr[i] > arr[i+1] { fail!(~"Array not sorted"); @@ -1107,7 +1107,7 @@ mod big_tests { } fn tabulate_managed(lo: uint, hi: uint) { - fn isSorted(arr: &[const @T]) { + fn isSorted(arr: &[const @T]) { for uint::range(0, arr.len()-1) |i| { if arr[i] > arr[i+1] { fail!(~"Array not sorted"); diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index fd0b0d6be3a2d..66d1739241788 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -84,7 +84,7 @@ struct SemInner { enum Sem = Exclusive>; #[doc(hidden)] -fn new_sem(count: int, q: Q) -> Sem { +fn new_sem(count: int, q: Q) -> Sem { Sem(exclusive(SemInner { mut count: count, waiters: new_waitqueue(), blocked: q })) } @@ -99,7 +99,7 @@ fn new_sem_and_signal(count: int, num_condvars: uint) } #[doc(hidden)] -impl &Sem { +impl &Sem { fn acquire() { let mut waiter_nobe = None; unsafe { @@ -167,7 +167,7 @@ type SemRelease = SemReleaseGeneric<()>; type SemAndSignalRelease = SemReleaseGeneric<~[Waitqueue]>; struct SemReleaseGeneric { sem: &Sem } -impl Drop for SemReleaseGeneric { +impl Drop for SemReleaseGeneric { fn finalize(&self) { self.sem.release(); } diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 6e1e6a331a296..6768ff2324877 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -39,7 +39,7 @@ use core; * * ch - a channel of type T to send a `val` on * * val - a value of type T to send over the provided `ch` */ -pub fn delayed_send(iotask: &IoTask, +pub fn delayed_send(iotask: &IoTask, msecs: uint, ch: &Chan, val: T) { @@ -123,7 +123,7 @@ pub fn sleep(iotask: &IoTask, msecs: uint) { * on the provided port in the allotted timeout period, then the result will * be a `Some(T)`. If not, then `None` will be returned. */ -pub fn recv_timeout(iotask: &IoTask, +pub fn recv_timeout(iotask: &IoTask, msecs: uint, wait_po: &Port) -> Option { diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index e4279a57ad5cd..eb3093a27451f 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -39,7 +39,7 @@ pub struct TreeMap { priv length: uint } -impl Eq for TreeMap { +impl Eq for TreeMap { pure fn eq(&self, other: &TreeMap) -> bool { if self.len() != other.len() { false @@ -66,7 +66,7 @@ impl Eq for TreeMap { } // Lexicographical comparison -pure fn lt(a: &TreeMap, b: &TreeMap) -> bool { +pure fn lt(a: &TreeMap, b: &TreeMap) -> bool { let mut x = a.iter(); let mut y = b.iter(); @@ -85,7 +85,7 @@ pure fn lt(a: &TreeMap, b: &TreeMap) -> bool { return a_len < b_len; } -impl Ord for TreeMap { +impl Ord for TreeMap { #[inline(always)] pure fn lt(&self, other: &TreeMap) -> bool { lt(self, other) @@ -104,7 +104,7 @@ impl Ord for TreeMap { } } -impl BaseIter<(&K, &V)> for TreeMap { +impl BaseIter<(&K, &V)> for TreeMap { /// Visit all key-value pairs in order pure fn each(&self, f: fn(&(&self/K, &self/V)) -> bool) { each(&self.root, f) @@ -112,14 +112,14 @@ impl BaseIter<(&K, &V)> for TreeMap { pure fn size_hint(&self) -> Option { Some(self.len()) } } -impl ReverseIter<(&K, &V)> for TreeMap { +impl ReverseIter<(&K, &V)> for TreeMap { /// Visit all key-value pairs in reverse order pure fn each_reverse(&self, f: fn(&(&self/K, &self/V)) -> bool) { each_reverse(&self.root, f); } } -impl Container for TreeMap { +impl Container for TreeMap { /// Return the number of elements in the map pure fn len(&self) -> uint { self.length } @@ -127,7 +127,7 @@ impl Container for TreeMap { pure fn is_empty(&self) -> bool { self.root.is_none() } } -impl Mutable for TreeMap { +impl Mutable for TreeMap { /// Clear the map, removing all key-value pairs. fn clear(&mut self) { self.root = None; @@ -135,7 +135,7 @@ impl Mutable for TreeMap { } } -impl Map for TreeMap { +impl Map for TreeMap { /// Return true if the map contains a value for the specified key pure fn contains_key(&self, key: &K) -> bool { self.find(key).is_some() @@ -184,7 +184,7 @@ impl Map for TreeMap { } } -impl TreeMap { +impl TreeMap { /// Create an empty TreeMap static pure fn new() -> TreeMap { TreeMap{root: None, length: 0} } @@ -212,7 +212,7 @@ pub struct TreeMapIterator { priv current: Option<&~TreeNode> } -impl TreeMapIterator { +impl TreeMapIterator { // Returns the current node, or None if this iterator is at the end. fn get(&const self) -> Option<(&self/K, &self/V)> { match self.current { @@ -224,7 +224,7 @@ impl TreeMapIterator { /// Advance the iterator to the next node (in order). If this iterator /// is finished, does nothing. -pub fn map_next(iter: &mut TreeMapIterator/&a) { +pub fn map_next(iter: &mut TreeMapIterator/&a) { while !iter.stack.is_empty() || iter.node.is_some() { match *iter.node { Some(ref x) => { @@ -246,25 +246,25 @@ pub struct TreeSet { priv map: TreeMap } -impl BaseIter for TreeSet { +impl BaseIter for TreeSet { /// Visit all values in order pure fn each(&self, f: fn(&T) -> bool) { self.map.each_key(f) } pure fn size_hint(&self) -> Option { Some(self.len()) } } -impl ReverseIter for TreeSet { +impl ReverseIter for TreeSet { /// Visit all values in reverse order pure fn each_reverse(&self, f: fn(&T) -> bool) { self.map.each_key_reverse(f) } } -impl Eq for TreeSet { +impl Eq for TreeSet { pure fn eq(&self, other: &TreeSet) -> bool { self.map == other.map } pure fn ne(&self, other: &TreeSet) -> bool { self.map != other.map } } -impl Ord for TreeSet { +impl Ord for TreeSet { #[inline(always)] pure fn lt(&self, other: &TreeSet) -> bool { self.map < other.map } #[inline(always)] @@ -275,7 +275,7 @@ impl Ord for TreeSet { pure fn gt(&self, other: &TreeSet) -> bool { self.map > other.map } } -impl Container for TreeSet { +impl Container for TreeSet { /// Return the number of elements in the set pure fn len(&self) -> uint { self.map.len() } @@ -283,12 +283,12 @@ impl Container for TreeSet { pure fn is_empty(&self) -> bool { self.map.is_empty() } } -impl Mutable for TreeSet { +impl Mutable for TreeSet { /// Clear the set, removing all values. fn clear(&mut self) { self.map.clear() } } -impl Set for TreeSet { +impl Set for TreeSet { /// Return true if the set contains a value pure fn contains(&self, value: &T) -> bool { self.map.contains_key(value) @@ -510,7 +510,7 @@ impl Set for TreeSet { } } -impl TreeSet { +impl TreeSet { /// Create an empty TreeSet static pure fn new() -> TreeSet { TreeSet{map: TreeMap::new()} } @@ -526,7 +526,7 @@ pub struct TreeSetIterator { priv iter: TreeMapIterator } -impl TreeSetIterator { +impl TreeSetIterator { /// Returns the current node, or None if this iterator is at the end. fn get(&const self) -> Option<&self/T> { match self.iter.get() { @@ -538,7 +538,7 @@ impl TreeSetIterator { /// Advance the iterator to the next node (in order). If this iterator is /// finished, does nothing. -pub fn set_next(iter: &mut TreeSetIterator/&a) { +pub fn set_next(iter: &mut TreeSetIterator/&a) { map_next(&mut iter.iter); } @@ -552,14 +552,14 @@ struct TreeNode { level: uint } -impl TreeNode { +impl TreeNode { #[inline(always)] static pure fn new(key: K, value: V) -> TreeNode { TreeNode{key: key, value: value, left: None, right: None, level: 1} } } -pure fn each(node: &r/Option<~TreeNode>, +pure fn each(node: &r/Option<~TreeNode>, f: fn(&(&r/K, &r/V)) -> bool) { do node.iter |x| { each(&x.left, f); @@ -567,7 +567,7 @@ pure fn each(node: &r/Option<~TreeNode>, } } -pure fn each_reverse(node: &r/Option<~TreeNode>, +pure fn each_reverse(node: &r/Option<~TreeNode>, f: fn(&(&r/K, &r/V)) -> bool) { do node.iter |x| { each_reverse(&x.right, f); @@ -576,7 +576,7 @@ pure fn each_reverse(node: &r/Option<~TreeNode>, } // Remove left horizontal link by rotating right -fn skew(node: &mut ~TreeNode) { +fn skew(node: &mut ~TreeNode) { if node.left.map_default(false, |x| x.level == node.level) { let mut save = node.left.swap_unwrap(); node.left <-> save.right; // save.right now None @@ -587,7 +587,7 @@ fn skew(node: &mut ~TreeNode) { // Remove dual horizontal link by rotating left and increasing level of // the parent -fn split(node: &mut ~TreeNode) { +fn split(node: &mut ~TreeNode) { if node.right.map_default(false, |x| x.right.map_default(false, |y| y.level == node.level)) { let mut save = node.right.swap_unwrap(); @@ -598,7 +598,7 @@ fn split(node: &mut ~TreeNode) { } } -fn insert(node: &mut Option<~TreeNode>, key: K, +fn insert(node: &mut Option<~TreeNode>, key: K, value: V) -> bool { match *node { Some(ref mut save) => { @@ -625,8 +625,8 @@ fn insert(node: &mut Option<~TreeNode>, key: K, } } -fn remove(node: &mut Option<~TreeNode>, key: &K) -> bool { - fn heir_swap(node: &mut ~TreeNode, +fn remove(node: &mut Option<~TreeNode>, key: &K) -> bool { + fn heir_swap(node: &mut ~TreeNode, child: &mut Option<~TreeNode>) { // *could* be done without recursion, but it won't borrow check do child.mutate |mut child| { @@ -772,7 +772,7 @@ mod test_treemap { assert m.find(&k1) == Some(&v1); } - fn check_equal(ctrl: &[(K, V)], map: &TreeMap) { + fn check_equal(ctrl: &[(K, V)], map: &TreeMap) { assert ctrl.is_empty() == map.is_empty(); for ctrl.each |x| { let &(k, v) = x; @@ -792,7 +792,7 @@ mod test_treemap { } } - fn check_left(node: &Option<~TreeNode>, + fn check_left(node: &Option<~TreeNode>, parent: &~TreeNode) { match *node { Some(ref r) => { @@ -805,7 +805,7 @@ mod test_treemap { } } - fn check_right(node: &Option<~TreeNode>, + fn check_right(node: &Option<~TreeNode>, parent: &~TreeNode, parent_red: bool) { match *node { Some(ref r) => { @@ -820,7 +820,7 @@ mod test_treemap { } } - fn check_structure(map: &TreeMap) { + fn check_structure(map: &TreeMap) { match map.root { Some(ref r) => { check_left(&r.left, r); diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index 70c03c69d2db3..4de7c1b992526 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -138,7 +138,7 @@ impl WorkKey { type WorkMap = LinearMap; -pub impl Encodable for WorkMap { +pub impl Encodable for WorkMap { fn encode(&self, s: &S) { let mut d = ~[]; for self.each |&(k, v)| { @@ -149,7 +149,7 @@ pub impl Encodable for WorkMap { } } -pub impl Decodable for WorkMap { +pub impl Decodable for WorkMap { static fn decode(&self, d: &D) -> WorkMap { let v : ~[(WorkKey,~str)] = Decodable::decode(d); let mut w = LinearMap::new(); diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 234cef5f6eb4d..6befb2f188042 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -32,7 +32,7 @@ macro_rules! interner_key ( #[deriving_eq] pub struct ident { repr: uint } -pub impl Encodable for ident { +pub impl Encodable for ident { fn encode(&self, s: &S) { let intr = match unsafe { task::local_data::local_data_get(interner_key!()) @@ -45,7 +45,7 @@ pub impl Encodable for ident { } } -pub impl Decodable for ident { +pub impl Decodable for ident { static fn decode(d: &D) -> ident { let intr = match unsafe { task::local_data::local_data_get(interner_key!()) @@ -383,7 +383,7 @@ pub enum inferable { infer(node_id) } -pub impl to_bytes::IterBytes for inferable { +pub impl to_bytes::IterBytes for inferable { pure fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) { match *self { expl(ref t) => diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 851b35ca3bd3f..c9bc41ed61e9b 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -140,12 +140,12 @@ pub impl cmp::Eq for span { pure fn ne(&self, other: &span) -> bool { !(*self).eq(other) } } -pub impl Encodable for span { +pub impl Encodable for span { /* Note #1972 -- spans are encoded but not decoded */ fn encode(&self, _s: &S) { } } -pub impl Decodable for span { +pub impl Decodable for span { static fn decode(_d: &D) -> span { dummy_sp() } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index ad0998d503a36..f378325d0abd5 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -300,7 +300,7 @@ fn print_macro_backtrace(cm: @codemap::CodeMap, sp: span) { } } -pub fn expect(diag: span_handler, +pub fn expect(diag: span_handler, opt: Option, msg: fn() -> ~str) -> T { match opt { diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 9ceaebe6dd1de..7fbba987cc7df 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -23,7 +23,7 @@ For example, a type like: would generate two implementations like: -impl Encodable for Node { +impl Encodable for Node { fn encode(&self, s: &S) { do s.emit_struct("Node", 1) { s.emit_field("id", 0, || s.emit_uint(self.id)) @@ -31,7 +31,7 @@ impl Encodable for Node { } } -impl Decodable for node_id { +impl Decodable for node_id { static fn decode(d: &D) -> Node { do d.read_struct("Node", 1) { Node { @@ -54,7 +54,7 @@ would yield functions like: S: Encoder, T: Encodable > spanned: Encodable { - fn encode(s: &S) { + fn encode(s: &S) { do s.emit_rec { s.emit_field("node", 0, || self.node.encode(s)); s.emit_field("span", 1, || self.span.encode(s)); diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index f4d0e57c5958d..49f7fe5853e7b 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -319,7 +319,7 @@ pub impl ext_ctxt_ast_builder for ext_ctxt { +items: ~[@ast::item]) -> @ast::item { // XXX: Total hack: import `core::kinds::Owned` to work around a - // parser bug whereby `fn f` doesn't parse. + // parser bug whereby `fn f` doesn't parse. let vi = ast::view_item_use(~[ @codemap::spanned { node: ast::view_path_simple( diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index e7b5005d8dbf4..4c9c9a5e52a83 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -212,7 +212,7 @@ pub impl Parser { // parse a sequence bracketed by '<' and '>', stopping // before the '>'. - fn parse_seq_to_before_gt(sep: Option, + fn parse_seq_to_before_gt(sep: Option, f: fn(Parser) -> T) -> ~[T] { let mut first = true; let mut v = ~[]; @@ -231,7 +231,7 @@ pub impl Parser { return v; } - fn parse_seq_to_gt(sep: Option, + fn parse_seq_to_gt(sep: Option, f: fn(Parser) -> T) -> ~[T] { let v = self.parse_seq_to_before_gt(sep, f); self.expect_gt(); @@ -240,7 +240,7 @@ pub impl Parser { } // parse a sequence bracketed by '<' and '>' - fn parse_seq_lt_gt(sep: Option, + fn parse_seq_lt_gt(sep: Option, f: fn(Parser) -> T) -> spanned<~[T]> { let lo = self.span.lo; self.expect(token::LT); @@ -253,7 +253,7 @@ pub impl Parser { // parse a sequence, including the closing delimiter. The function // f must consume tokens until reaching the next separator or // closing bracket. - fn parse_seq_to_end(ket: token::Token, sep: seq_sep, + fn parse_seq_to_end(ket: token::Token, sep: seq_sep, f: fn(Parser) -> T) -> ~[T] { let val = self.parse_seq_to_before_end(ket, sep, f); self.bump(); @@ -263,7 +263,7 @@ pub impl Parser { // parse a sequence, not including the closing delimiter. The function // f must consume tokens until reaching the next separator or // closing bracket. - fn parse_seq_to_before_end(ket: token::Token, sep: seq_sep, + fn parse_seq_to_before_end(ket: token::Token, sep: seq_sep, f: fn(Parser) -> T) -> ~[T] { let mut first: bool = true; let mut v: ~[T] = ~[]; @@ -284,7 +284,7 @@ pub impl Parser { // parse a sequence, including the closing delimiter. The function // f must consume tokens until reaching the next separator or // closing bracket. - fn parse_unspanned_seq(bra: token::Token, + fn parse_unspanned_seq(bra: token::Token, ket: token::Token, sep: seq_sep, f: fn(Parser) -> T) -> ~[T] { @@ -296,7 +296,7 @@ pub impl Parser { // NB: Do not use this function unless you actually plan to place the // spanned list in the AST. - fn parse_seq(bra: token::Token, ket: token::Token, sep: seq_sep, + fn parse_seq(bra: token::Token, ket: token::Token, sep: seq_sep, f: fn(Parser) -> T) -> spanned<~[T]> { let lo = self.span.lo; self.expect(bra); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index eeba00be70461..ab7e3204b7b31 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2282,7 +2282,7 @@ pub mod test { //use util; use util::testing::check_equal; - fn string_check (given : &T, expected: &T) { + fn string_check (given : &T, expected: &T) { if !(given == expected) { fail!(fmt!("given %?, expected %?",given,expected)); } diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index dcb3261169be4..4b13818974c30 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -23,7 +23,7 @@ pub struct Interner { } // when traits can extend traits, we should extend index to get [] -pub impl Interner { +pub impl Interner { static fn new() -> Interner { Interner { map: LinearMap::new(), diff --git a/src/libsyntax/util/testing.rs b/src/libsyntax/util/testing.rs index b6d333349a091..78a175df29f27 100644 --- a/src/libsyntax/util/testing.rs +++ b/src/libsyntax/util/testing.rs @@ -11,13 +11,13 @@ // support for test cases. use core::cmp; -pub pure fn check_equal_ptr (given : &T, expected: &T) { +pub pure fn check_equal_ptr (given : &T, expected: &T) { if !((given == expected) && (expected == given )) { fail!(fmt!("given %?, expected %?",given,expected)); } } -pub pure fn check_equal (given : T, expected: T) { +pub pure fn check_equal (given : T, expected: T) { if !((given == expected) && (expected == given )) { fail!(fmt!("given %?, expected %?",given,expected)); } diff --git a/src/test/auxiliary/cci_capture_clause.rs b/src/test/auxiliary/cci_capture_clause.rs index 70a2b8f680a5c..8038c5fc41ac4 100644 --- a/src/test/auxiliary/cci_capture_clause.rs +++ b/src/test/auxiliary/cci_capture_clause.rs @@ -10,7 +10,7 @@ use core::pipes::*; -pub fn foo(x: T) -> Port { +pub fn foo(x: T) -> Port { let (p, c) = stream(); do task::spawn() { c.send(x); diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index 8f1c3d5bb5f52..1be18459e407c 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -16,11 +16,11 @@ pub struct Entry {key: A, value: B} pub struct alist { eq_fn: fn@(A,A) -> bool, data: DVec> } -pub fn alist_add(lst: alist, k: A, v: B) { +pub fn alist_add(lst: alist, k: A, v: B) { lst.data.push(Entry{key:k, value:v}); } -pub fn alist_get(lst: alist, k: A) -> B { +pub fn alist_get(lst: alist, k: A) -> B { let eq_fn = lst.eq_fn; for lst.data.each |entry| { if eq_fn(entry.key, k) { return entry.value; } @@ -29,13 +29,13 @@ pub fn alist_get(lst: alist, k: A) -> B { } #[inline] -pub fn new_int_alist() -> alist { +pub fn new_int_alist() -> alist { fn eq_int(&&a: int, &&b: int) -> bool { a == b } return alist {eq_fn: eq_int, data: DVec()}; } #[inline] -pub fn new_int_alist_2() -> alist { +pub fn new_int_alist_2() -> alist { #[inline] fn eq_int(&&a: int, &&b: int) -> bool { a == b } return alist {eq_fn: eq_int, data: DVec()}; diff --git a/src/test/auxiliary/issue-2526.rs b/src/test/auxiliary/issue-2526.rs index f9d08713852e4..958fb75b9d233 100644 --- a/src/test/auxiliary/issue-2526.rs +++ b/src/test/auxiliary/issue-2526.rs @@ -23,13 +23,13 @@ impl Drop for arc_destruct { fn finalize(&self) {} } -fn arc_destruct(data: int) -> arc_destruct { +fn arc_destruct(data: int) -> arc_destruct { arc_destruct { _data: data } } -fn arc(_data: T) -> arc_destruct { +fn arc(_data: T) -> arc_destruct { arc_destruct(0) } diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index 8679d3a778607..b1fb7a82c5c8b 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -19,6 +19,6 @@ use std::oldmap::HashMap; pub type header_map = HashMap<~str, @DVec<@~str>>; // the unused ty param is necessary so this gets monomorphized -pub fn request(req: header_map) { +pub fn request(req: header_map) { let _x = copy *(copy *req.get(&~"METHOD"))[0u]; } diff --git a/src/test/auxiliary/issue4516_ty_param_lib.rs b/src/test/auxiliary/issue4516_ty_param_lib.rs index 2e3c7eedfcc38..0e2105243e703 100644 --- a/src/test/auxiliary/issue4516_ty_param_lib.rs +++ b/src/test/auxiliary/issue4516_ty_param_lib.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn to_closure(x: A) -> @fn() -> A { +pub fn to_closure(x: A) -> @fn() -> A { fn@() -> A { copy x } } diff --git a/src/test/auxiliary/static-methods-crate.rs b/src/test/auxiliary/static-methods-crate.rs index f06f2e31b710f..dbfff4e8acaaf 100644 --- a/src/test/auxiliary/static-methods-crate.rs +++ b/src/test/auxiliary/static-methods-crate.rs @@ -33,7 +33,7 @@ impl read for bool { } } -pub fn read(s: ~str) -> T { +pub fn read(s: ~str) -> T { match read::readMaybe(s) { Some(x) => x, _ => fail!(~"read failed!") diff --git a/src/test/auxiliary/trait_inheritance_auto_xc_aux.rs b/src/test/auxiliary/trait_inheritance_auto_xc_aux.rs index 97a363f6b0c45..3e26a09fb8f0d 100644 --- a/src/test/auxiliary/trait_inheritance_auto_xc_aux.rs +++ b/src/test/auxiliary/trait_inheritance_auto_xc_aux.rs @@ -14,4 +14,4 @@ trait Baz { fn h() -> int; } trait Quux: Foo Bar Baz { } -impl Quux for T { } +impl Quux for T { } diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index 65bb9fc1e9009..2845596e78007 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -32,7 +32,7 @@ fn timed(result: &mut float, op: fn()) { } impl Results { - fn bench_int>(&mut self, rng: @rand::Rng, num_keys: uint, + fn bench_int>(&mut self, rng: @rand::Rng, num_keys: uint, rand_cap: uint, f: fn() -> T) { { let mut set = f(); @@ -70,7 +70,7 @@ impl Results { } } - fn bench_str>(&mut self, rng: @rand::Rng, num_keys: uint, + fn bench_str>(&mut self, rng: @rand::Rng, num_keys: uint, f: fn() -> T) { { let mut set = f(); diff --git a/src/test/bench/pingpong.rs b/src/test/bench/pingpong.rs index 11a127b9722f4..16f44b88793c8 100644 --- a/src/test/bench/pingpong.rs +++ b/src/test/bench/pingpong.rs @@ -72,7 +72,7 @@ macro_rules! follow ( ) ) -fn switch(+endp: pipes::RecvPacketBuffered, +fn switch(+endp: pipes::RecvPacketBuffered, f: fn(+v: Option) -> U) -> U { f(pipes::try_recv(endp)) } diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 78ae31570b335..a887a13bf3802 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -27,14 +27,14 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str { return (xx as float) * 100f / (yy as float); } - pure fn le_by_val(kv0: &(TT,UU), + pure fn le_by_val(kv0: &(TT,UU), kv1: &(TT,UU)) -> bool { let (_, v0) = *kv0; let (_, v1) = *kv1; return v0 >= v1; } - pure fn le_by_key(kv0: &(TT,UU), + pure fn le_by_key(kv0: &(TT,UU), kv1: &(TT,UU)) -> bool { let (k0, _) = *kv0; let (k1, _) = *kv1; @@ -42,7 +42,7 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str { } // sort by key, then by value - fn sortKV(orig: ~[(TT,UU)]) -> ~[(TT,UU)] { + fn sortKV(orig: ~[(TT,UU)]) -> ~[(TT,UU)] { return sort::merge_sort(sort::merge_sort(orig, le_by_key), le_by_val); } diff --git a/src/test/compile-fail/ambig_impl_bounds.rs b/src/test/compile-fail/ambig_impl_bounds.rs index d4fe51835aee5..92581d756db03 100644 --- a/src/test/compile-fail/ambig_impl_bounds.rs +++ b/src/test/compile-fail/ambig_impl_bounds.rs @@ -11,7 +11,7 @@ trait A { fn foo(); } trait B { fn foo(); } -fn foo(t: T) { +fn foo(t: T) { t.foo(); //~ ERROR multiple applicable methods in scope //~^ NOTE candidate #1 derives from the bound `A` //~^^ NOTE candidate #2 derives from the bound `B` diff --git a/src/test/compile-fail/issue-2611-3.rs b/src/test/compile-fail/issue-2611-3.rs index 5da3d08e34c56..c9aeaae0ff934 100644 --- a/src/test/compile-fail/issue-2611-3.rs +++ b/src/test/compile-fail/issue-2611-3.rs @@ -16,7 +16,7 @@ use iter::BaseIter; trait A { - fn b(x: C) -> C; + fn b(x: C) -> C; } struct E { @@ -24,7 +24,7 @@ struct E { } impl A for E { - fn b(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 1 bound, but + fn b(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 1 bound, but } fn main() {} diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs index c8f3f9a4a5a3d..fb7c5bd6cb87b 100644 --- a/src/test/compile-fail/issue-2611-4.rs +++ b/src/test/compile-fail/issue-2611-4.rs @@ -13,7 +13,7 @@ use iter::BaseIter; trait A { - fn b(x: C) -> C; + fn b(x: C) -> C; } struct E { @@ -21,7 +21,7 @@ struct E { } impl A for E { - fn b(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but + fn b(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but } fn main() {} diff --git a/src/test/compile-fail/issue-2611-5.rs b/src/test/compile-fail/issue-2611-5.rs index f8f7704bcd9d0..35015a260f5af 100644 --- a/src/test/compile-fail/issue-2611-5.rs +++ b/src/test/compile-fail/issue-2611-5.rs @@ -13,7 +13,7 @@ use iter::BaseIter; trait A { - fn b(x: C) -> C; + fn b(x: C) -> C; } struct E { @@ -22,7 +22,7 @@ struct E { impl A for E { // n.b. The error message is awful -- see #3404 - fn b(_x: G) -> G { fail!() } //~ ERROR method `b` has an incompatible type + fn b(_x: G) -> G { fail!() } //~ ERROR method `b` has an incompatible type } fn main() {} diff --git a/src/test/compile-fail/issue-2766-a.rs b/src/test/compile-fail/issue-2766-a.rs index 0b63ae5b1bad3..77a840e7e366d 100644 --- a/src/test/compile-fail/issue-2766-a.rs +++ b/src/test/compile-fail/issue-2766-a.rs @@ -9,12 +9,12 @@ // except according to those terms. pub mod stream { - pub enum Stream { send(T, ::stream::server::Stream), } + pub enum Stream { send(T, ::stream::server::Stream), } pub mod server { use core::option; use core::pipes; - impl Stream { + impl Stream { pub fn recv() -> extern fn(+v: Stream) -> ::stream::Stream { // resolve really should report just one error here. // Change the test case when it changes. @@ -28,7 +28,7 @@ pub mod stream { } } - pub type Stream = pipes::RecvPacket<::stream::Stream>; + pub type Stream = pipes::RecvPacket<::stream::Stream>; } } diff --git a/src/test/compile-fail/issue-3177-mutable-struct.rs b/src/test/compile-fail/issue-3177-mutable-struct.rs index a71826c629b6c..ab28b461a2c6b 100644 --- a/src/test/compile-fail/issue-3177-mutable-struct.rs +++ b/src/test/compile-fail/issue-3177-mutable-struct.rs @@ -10,7 +10,7 @@ // xfail-test // error-pattern: instantiating a type parameter with an incompatible type -struct S { +struct S { s: T, mut cant_nest: () } diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs index 3d83f13c211ba..b2cef943528fe 100644 --- a/src/test/compile-fail/kindck-owned-trait-scoped.rs +++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs @@ -35,7 +35,7 @@ fn to_foo_2(t: T) -> foo { {f:t} as foo //~ ERROR value may contain borrowed pointers; use `&static` bound } -fn to_foo_3(t: T) -> foo { +fn to_foo_3(t: T) -> foo { // OK---T may escape as part of the returned foo value, but it is // owned and hence does not contain borrowed ptrs {f:t} as foo diff --git a/src/test/compile-fail/kindck-owned-trait.rs b/src/test/compile-fail/kindck-owned-trait.rs index 683d66d0d72e9..2bc6a91120424 100644 --- a/src/test/compile-fail/kindck-owned-trait.rs +++ b/src/test/compile-fail/kindck-owned-trait.rs @@ -10,11 +10,11 @@ trait foo { fn foo(); } -fn to_foo(t: T) -> foo { +fn to_foo(t: T) -> foo { t as foo //~ ERROR value may contain borrowed pointers; use `&static` bound } -fn to_foo2(t: T) -> foo { +fn to_foo2(t: T) -> foo { t as foo } diff --git a/src/test/compile-fail/kindck-owned.rs b/src/test/compile-fail/kindck-owned.rs index 65f6f837c83a0..e792917622b3f 100644 --- a/src/test/compile-fail/kindck-owned.rs +++ b/src/test/compile-fail/kindck-owned.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn copy1(t: T) -> fn@() -> T { +fn copy1(t: T) -> fn@() -> T { fn@() -> T { t } //~ ERROR value may contain borrowed pointers } -fn copy2(t: T) -> fn@() -> T { +fn copy2(t: T) -> fn@() -> T { fn@() -> T { t } } diff --git a/src/test/compile-fail/liveness-use-after-send.rs b/src/test/compile-fail/liveness-use-after-send.rs index f852fb1d38e42..95dd59eb27f73 100644 --- a/src/test/compile-fail/liveness-use-after-send.rs +++ b/src/test/compile-fail/liveness-use-after-send.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn send(ch: _chan, -data: T) { +fn send(ch: _chan, -data: T) { log(debug, ch); log(debug, data); fail!(); diff --git a/src/test/compile-fail/non-const.rs b/src/test/compile-fail/non-const.rs index 9bc4ce87787ed..43c91490a9686 100644 --- a/src/test/compile-fail/non-const.rs +++ b/src/test/compile-fail/non-const.rs @@ -10,7 +10,7 @@ // Test that various non const things are rejected. -fn foo(_x: T) { } +fn foo(_x: T) { } struct r { x:int, diff --git a/src/test/compile-fail/obsolete-syntax.rs b/src/test/compile-fail/obsolete-syntax.rs index d92b545d1701f..ac873238bfc0d 100644 --- a/src/test/compile-fail/obsolete-syntax.rs +++ b/src/test/compile-fail/obsolete-syntax.rs @@ -8,16 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f1() -> T { } +fn f1() -> T { } //~^ ERROR obsolete syntax: lower-case kind bounds -fn f1() -> T { } +fn f1() -> T { } //~^ ERROR obsolete syntax: lower-case kind bounds -fn f1() -> T { } +fn f1() -> T { } //~^ ERROR obsolete syntax: lower-case kind bounds -fn f1() -> T { } +fn f1() -> T { } //~^ ERROR obsolete syntax: lower-case kind bounds struct s { diff --git a/src/test/compile-fail/regions-escape-via-trait-or-not.rs b/src/test/compile-fail/regions-escape-via-trait-or-not.rs index 0681680b9c4a2..e4598adca27df 100644 --- a/src/test/compile-fail/regions-escape-via-trait-or-not.rs +++ b/src/test/compile-fail/regions-escape-via-trait-or-not.rs @@ -18,7 +18,7 @@ impl deref for &int { } } -fn with(f: fn(x: &int) -> R) -> int { +fn with(f: fn(x: &int) -> R) -> int { f(&3).get() } diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index d36b53eb2ee71..26058bf89cad7 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(_i: T) { +fn f(_i: T) { } fn main() { diff --git a/src/test/compile-fail/vec-concat-bug.rs b/src/test/compile-fail/vec-concat-bug.rs index f9ad20eaeb9b4..478e01ccd042e 100644 --- a/src/test/compile-fail/vec-concat-bug.rs +++ b/src/test/compile-fail/vec-concat-bug.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn concat(v: ~[const ~[const T]]) -> ~[T] { +fn concat(v: ~[const ~[const T]]) -> ~[T] { let mut r = ~[]; // Earlier versions of our type checker accepted this: diff --git a/src/test/compile-fail/vtable-res-trait-param.rs b/src/test/compile-fail/vtable-res-trait-param.rs index 7b48eca3dbe23..bd886f44ede84 100644 --- a/src/test/compile-fail/vtable-res-trait-param.rs +++ b/src/test/compile-fail/vtable-res-trait-param.rs @@ -13,16 +13,16 @@ trait TraitA { } trait TraitB { - fn gimme_an_a(a: A) -> int; + fn gimme_an_a(a: A) -> int; } impl TraitB for int { - fn gimme_an_a(a: A) -> int { + fn gimme_an_a(a: A) -> int { a.method_a() + self } } -fn call_it(b: B) -> int { +fn call_it(b: B) -> int { let y = 4u; b.gimme_an_a(y) //~ ERROR failed to find an implementation of trait @TraitA } diff --git a/src/test/run-fail/bug-811.rs b/src/test/run-fail/bug-811.rs index 85e0f3dd398ee..4dada6257d4b0 100644 --- a/src/test/run-fail/bug-811.rs +++ b/src/test/run-fail/bug-811.rs @@ -16,6 +16,6 @@ type port_id = int; enum chan_t = {task: task_id, port: port_id}; -fn send(ch: chan_t, data: T) { fail!(); } +fn send(ch: chan_t, data: T) { fail!(); } fn main() { fail!(~"quux"); } diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index 350132c15b829..2972c425192a8 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -12,7 +12,7 @@ type pair = { a: A, b: B }; -fn f(a: A, b: u16) -> fn@() -> (A, u16) { +fn f(a: A, b: u16) -> fn@() -> (A, u16) { fn@() -> (A, u16) { (a, b) } } diff --git a/src/test/run-pass/alignment-gep-tup-like-2.rs b/src/test/run-pass/alignment-gep-tup-like-2.rs index e16fae776f7e9..2a09de7a81c22 100644 --- a/src/test/run-pass/alignment-gep-tup-like-2.rs +++ b/src/test/run-pass/alignment-gep-tup-like-2.rs @@ -23,7 +23,7 @@ fn make_cycle(a: A) { g.rec = Some(g); } -fn f(a: A, b: B) -> fn@() -> (A, B) { +fn f(a: A, b: B) -> fn@() -> (A, B) { fn@() -> (A, B) { (a, b) } } diff --git a/src/test/run-pass/auto-encode.rs b/src/test/run-pass/auto-encode.rs index d4171ceb70fd2..6bf5293913f57 100644 --- a/src/test/run-pass/auto-encode.rs +++ b/src/test/run-pass/auto-encode.rs @@ -26,7 +26,7 @@ use std::serialize::{Encodable, Decodable}; use std::prettyprint; use std::time; -fn test_prettyprint>( +fn test_prettyprint>( a: &A, expected: &~str ) { diff --git a/src/test/run-pass/auto-instantiate.rs b/src/test/run-pass/auto-instantiate.rs index 8f7a88f19a73a..4075ec5603813 100644 --- a/src/test/run-pass/auto-instantiate.rs +++ b/src/test/run-pass/auto-instantiate.rs @@ -16,7 +16,7 @@ struct Pair { a: T, b: U } struct Triple { x: int, y: int, z: int } -fn f(x: T, y: U) -> Pair { return Pair {a: x, b: y}; } +fn f(x: T, y: U) -> Pair { return Pair {a: x, b: y}; } pub fn main() { log(debug, f(Triple {x: 3, y: 4, z: 5}, 4).a.x); diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index 0b969540d74c0..316627e349be0 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(x: ~[T]) -> T { return x[0]; } +fn f(x: ~[T]) -> T { return x[0]; } fn g(act: fn(~[int]) -> int) -> int { return act(~[1, 2, 3]); } diff --git a/src/test/run-pass/autoderef-method-on-trait-monomorphized.rs b/src/test/run-pass/autoderef-method-on-trait-monomorphized.rs index 53dd6f942e860..b44d1cbb78d48 100644 --- a/src/test/run-pass/autoderef-method-on-trait-monomorphized.rs +++ b/src/test/run-pass/autoderef-method-on-trait-monomorphized.rs @@ -16,7 +16,7 @@ impl double for uint { fn double() -> uint { self * 2u } } -fn is_equal(x: @D, exp: uint) { +fn is_equal(x: @D, exp: uint) { assert x.double() == exp; } diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index 60f19b4db0a7d..8bc02eb2f9f3f 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -12,7 +12,7 @@ trait Foo { fn foo(&self) -> ~str; } -impl Foo for @T { +impl Foo for @T { fn foo(&self) -> ~str { fmt!("@%s", (**self).foo()) } diff --git a/src/test/run-pass/borrowed-ptr-pattern.rs b/src/test/run-pass/borrowed-ptr-pattern.rs index fdf4a16156064..b51481f1ea1a1 100644 --- a/src/test/run-pass/borrowed-ptr-pattern.rs +++ b/src/test/run-pass/borrowed-ptr-pattern.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(x: &T) -> T{ +fn foo(x: &T) -> T{ match x { &a => a } diff --git a/src/test/run-pass/box-unbox.rs b/src/test/run-pass/box-unbox.rs index 6889d764cbbb0..1efe12c1a3c18 100644 --- a/src/test/run-pass/box-unbox.rs +++ b/src/test/run-pass/box-unbox.rs @@ -12,7 +12,7 @@ struct Box {c: @T} -fn unbox(b: Box) -> T { return *b.c; } +fn unbox(b: Box) -> T { return *b.c; } pub fn main() { let foo: int = 17; diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs index 1d1b07ae32461..f81b12b555e4b 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs @@ -14,7 +14,7 @@ extern mod cci_class_cast; use core::to_str::ToStr; use cci_class_cast::kitty::*; -fn print_out(thing: T, expected: ~str) { +fn print_out(thing: T, expected: ~str) { let actual = thing.to_str(); debug!("%s", actual); assert(actual == expected); diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate.rs b/src/test/run-pass/class-cast-to-trait-cross-crate.rs index 36e6c6b487d5a..d21ff90e7fbd5 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate.rs @@ -48,7 +48,7 @@ class cat : to_str { fn to_str() -> str { self.name } } -fn print_out(thing: T, expected: str) { +fn print_out(thing: T, expected: str) { let actual = thing.to_str(); debug!("%s", actual); assert(actual == expected); diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs index b72a8e5da2710..f35a91c2b914f 100644 --- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs @@ -79,7 +79,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat { } -fn annoy_neighbors(critter: T) { +fn annoy_neighbors(critter: T) { for uint::range(0u, 10u) |i| { critter.speak(); } } diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs index 06a2dbeb9a499..15564d73e1f70 100644 --- a/src/test/run-pass/class-implement-traits.rs +++ b/src/test/run-pass/class-implement-traits.rs @@ -59,7 +59,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat { } -fn make_speak(c: C) { +fn make_speak(c: C) { c.speak(); } diff --git a/src/test/run-pass/class-implements-multiple-traits.rs b/src/test/run-pass/class-implements-multiple-traits.rs index 6d2fb9843652e..a05b74c9a3c55 100644 --- a/src/test/run-pass/class-implements-multiple-traits.rs +++ b/src/test/run-pass/class-implements-multiple-traits.rs @@ -96,14 +96,14 @@ class cat : noisy, scratchy, bitey { } } -fn annoy_neighbors(critter: T) { +fn annoy_neighbors(critter: T) { for uint::range(0u, 10u) |i| { let what = critter.speak(); debug!("%u %d", i, what); } } -fn bite_everything(critter: T) -> bool { +fn bite_everything(critter: T) -> bool { let mut left : ~[body_part] = ~[finger, toe, nose, ear]; while vec::len(left) > 0u { let part = critter.bite(); @@ -118,7 +118,7 @@ fn bite_everything(critter: T) -> bool { true } -fn scratched_something(critter: T) -> bool { +fn scratched_something(critter: T) -> bool { option::is_some(critter.scratch()) } diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs index 919fb058a953a..fda358a86a2f5 100644 --- a/src/test/run-pass/class-separate-impl.rs +++ b/src/test/run-pass/class-separate-impl.rs @@ -57,7 +57,7 @@ impl ToStr for cat { pure fn to_str(&self) -> ~str { copy self.name } } -fn print_out(thing: T, expected: ~str) { +fn print_out(thing: T, expected: ~str) { let actual = thing.to_str(); debug!("%s", actual); assert(actual == expected); diff --git a/src/test/run-pass/class-trait-bounded-param.rs b/src/test/run-pass/class-trait-bounded-param.rs index e3c4703432fec..5e39b18db7375 100644 --- a/src/test/run-pass/class-trait-bounded-param.rs +++ b/src/test/run-pass/class-trait-bounded-param.rs @@ -13,7 +13,7 @@ extern mod std; use std::oldmap::{map, hashmap, int_hash}; -class keys> +class keys> : iter::base_iter { let map: M; diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs index d218519a4f3e5..32f39177e1c06 100644 --- a/src/test/run-pass/close-over-big-then-small-data.rs +++ b/src/test/run-pass/close-over-big-then-small-data.rs @@ -16,7 +16,7 @@ type pair = { a: A, b: B }; -fn f(a: A, b: u16) -> fn@() -> (A, u16) { +fn f(a: A, b: u16) -> fn@() -> (A, u16) { fn@() -> (A, u16) { (a, b) } } diff --git a/src/test/run-pass/const-bound.rs b/src/test/run-pass/const-bound.rs index 2320a5b1aa389..d4467ca0c7a06 100644 --- a/src/test/run-pass/const-bound.rs +++ b/src/test/run-pass/const-bound.rs @@ -12,7 +12,7 @@ // are const. -fn foo(x: T) -> T { x } +fn foo(x: T) -> T { x } struct F { field: int } diff --git a/src/test/run-pass/explicit-self-objects-ext-1.rs b/src/test/run-pass/explicit-self-objects-ext-1.rs index 80c18ca0974a4..e226423f84805 100644 --- a/src/test/run-pass/explicit-self-objects-ext-1.rs +++ b/src/test/run-pass/explicit-self-objects-ext-1.rs @@ -13,7 +13,7 @@ pub trait ReaderUtil { fn read_bytes(&self, len: uint); } -impl ReaderUtil for T { +impl ReaderUtil for T { fn read_bytes(&self, len: uint) { let mut count = self.read(&mut [0], len); diff --git a/src/test/run-pass/explicit-self-objects-ext-2.rs b/src/test/run-pass/explicit-self-objects-ext-2.rs index 80c18ca0974a4..e226423f84805 100644 --- a/src/test/run-pass/explicit-self-objects-ext-2.rs +++ b/src/test/run-pass/explicit-self-objects-ext-2.rs @@ -13,7 +13,7 @@ pub trait ReaderUtil { fn read_bytes(&self, len: uint); } -impl ReaderUtil for T { +impl ReaderUtil for T { fn read_bytes(&self, len: uint) { let mut count = self.read(&mut [0], len); diff --git a/src/test/run-pass/explicit-self-objects-ext-3.rs b/src/test/run-pass/explicit-self-objects-ext-3.rs index a32ac955b946b..1a18ee7c6f750 100644 --- a/src/test/run-pass/explicit-self-objects-ext-3.rs +++ b/src/test/run-pass/explicit-self-objects-ext-3.rs @@ -13,7 +13,7 @@ pub trait ReaderUtil { fn read_bytes(len: uint); } -impl ReaderUtil for T { +impl ReaderUtil for T { fn read_bytes(len: uint) { let mut count = self.read(&mut [0], len); diff --git a/src/test/run-pass/explicit-self-objects-ext-4.rs b/src/test/run-pass/explicit-self-objects-ext-4.rs index ca7764f96f4f1..a5d934d998494 100644 --- a/src/test/run-pass/explicit-self-objects-ext-4.rs +++ b/src/test/run-pass/explicit-self-objects-ext-4.rs @@ -13,7 +13,7 @@ pub trait ReaderUtil { fn read_bytes(len: uint); } -impl ReaderUtil for T { +impl ReaderUtil for T { fn read_bytes(len: uint) { let mut count = self.read(&mut [0], len); diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs index 9176e8672b2e1..224ae2cf78e23 100644 --- a/src/test/run-pass/expr-alt-generic-box2.rs +++ b/src/test/run-pass/expr-alt-generic-box2.rs @@ -15,7 +15,7 @@ type compare = fn@(T, T) -> bool; -fn test_generic(expected: T, eq: compare) { +fn test_generic(expected: T, eq: compare) { let actual: T = match true { true => { expected }, _ => fail!(~"wat") }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique1.rs b/src/test/run-pass/expr-alt-generic-unique1.rs index 36c591da853b2..ec51fabd4a750 100644 --- a/src/test/run-pass/expr-alt-generic-unique1.rs +++ b/src/test/run-pass/expr-alt-generic-unique1.rs @@ -13,7 +13,7 @@ // -*- rust -*- type compare = fn@(~T, ~T) -> bool; -fn test_generic(expected: ~T, eq: compare) { +fn test_generic(expected: ~T, eq: compare) { let actual: ~T = match true { true => { copy expected }, _ => fail!(~"wat") diff --git a/src/test/run-pass/expr-alt-generic-unique2.rs b/src/test/run-pass/expr-alt-generic-unique2.rs index 2a504c2e2bd4f..cb641b493e0a4 100644 --- a/src/test/run-pass/expr-alt-generic-unique2.rs +++ b/src/test/run-pass/expr-alt-generic-unique2.rs @@ -15,7 +15,7 @@ type compare = fn@(T, T) -> bool; -fn test_generic(expected: T, eq: compare) { +fn test_generic(expected: T, eq: compare) { let actual: T = match true { true => copy expected, _ => fail!(~"wat") diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs index d631e4eac5ebf..95710eecddb86 100644 --- a/src/test/run-pass/expr-alt-generic.rs +++ b/src/test/run-pass/expr-alt-generic.rs @@ -14,7 +14,7 @@ type compare = fn@(T, T) -> bool; -fn test_generic(expected: T, eq: compare) { +fn test_generic(expected: T, eq: compare) { let actual: T = match true { true => { expected }, _ => fail!(~"wat") }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic-box2.rs b/src/test/run-pass/expr-block-generic-box2.rs index 94627082eb47f..3851578d54748 100644 --- a/src/test/run-pass/expr-block-generic-box2.rs +++ b/src/test/run-pass/expr-block-generic-box2.rs @@ -14,7 +14,7 @@ type compare = fn@(T, T) -> bool; -fn test_generic(expected: T, eq: compare) { +fn test_generic(expected: T, eq: compare) { let actual: T = { expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs index b3637f805356a..c4efe32a31ec1 100644 --- a/src/test/run-pass/expr-block-generic-unique1.rs +++ b/src/test/run-pass/expr-block-generic-unique1.rs @@ -13,7 +13,7 @@ // -*- rust -*- type compare = fn@(~T, ~T) -> bool; -fn test_generic(expected: ~T, eq: compare) { +fn test_generic(expected: ~T, eq: compare) { let actual: ~T = { copy expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic-unique2.rs b/src/test/run-pass/expr-block-generic-unique2.rs index 39585f7cc6771..b0a056e889180 100644 --- a/src/test/run-pass/expr-block-generic-unique2.rs +++ b/src/test/run-pass/expr-block-generic-unique2.rs @@ -14,7 +14,7 @@ type compare = fn@(T, T) -> bool; -fn test_generic(expected: T, eq: compare) { +fn test_generic(expected: T, eq: compare) { let actual: T = { expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic.rs b/src/test/run-pass/expr-block-generic.rs index dca3030df14f7..3d1ef7dbea2c8 100644 --- a/src/test/run-pass/expr-block-generic.rs +++ b/src/test/run-pass/expr-block-generic.rs @@ -16,7 +16,7 @@ // Tests for standalone blocks as expressions with dynamic type sizes type compare = fn@(T, T) -> bool; -fn test_generic(expected: T, eq: compare) { +fn test_generic(expected: T, eq: compare) { let actual: T = { expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-fn.rs b/src/test/run-pass/expr-fn.rs index 727524f567763..0db78f776c45e 100644 --- a/src/test/run-pass/expr-fn.rs +++ b/src/test/run-pass/expr-fn.rs @@ -19,7 +19,7 @@ fn test_vec() { } fn test_generic() { - fn f(t: T) -> T { t } + fn f(t: T) -> T { t } assert (f(10) == 10); } diff --git a/src/test/run-pass/expr-if-generic-box2.rs b/src/test/run-pass/expr-if-generic-box2.rs index c1bd258930127..5a879071a8814 100644 --- a/src/test/run-pass/expr-if-generic-box2.rs +++ b/src/test/run-pass/expr-if-generic-box2.rs @@ -14,7 +14,7 @@ type compare = fn@(T, T) -> bool; -fn test_generic(expected: T, not_expected: T, eq: compare) { +fn test_generic(expected: T, not_expected: T, eq: compare) { let actual: T = if true { expected } else { not_expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-if-generic.rs b/src/test/run-pass/expr-if-generic.rs index 537f6039af8e6..179268a22b802 100644 --- a/src/test/run-pass/expr-if-generic.rs +++ b/src/test/run-pass/expr-if-generic.rs @@ -15,7 +15,7 @@ // Tests for if as expressions with dynamic type sizes type compare = fn@(T, T) -> bool; -fn test_generic(expected: T, not_expected: T, eq: compare) { +fn test_generic(expected: T, not_expected: T, eq: compare) { let actual: T = if true { expected } else { not_expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/fixed-point-bind-unique.rs b/src/test/run-pass/fixed-point-bind-unique.rs index e41fa1af90f7f..8547180b933ff 100644 --- a/src/test/run-pass/fixed-point-bind-unique.rs +++ b/src/test/run-pass/fixed-point-bind-unique.rs @@ -11,11 +11,11 @@ // xfail-fast #[legacy_modes]; -fn fix_help(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { +fn fix_help(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { return f(|a| fix_help(f, a), x); } -fn fix(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { +fn fix(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { return |a| fix_help(f, a); } diff --git a/src/test/run-pass/fn-bare-spawn.rs b/src/test/run-pass/fn-bare-spawn.rs index c875b805ea3ca..9b2a8d0c68177 100644 --- a/src/test/run-pass/fn-bare-spawn.rs +++ b/src/test/run-pass/fn-bare-spawn.rs @@ -10,7 +10,7 @@ // This is what the signature to spawn should look like with bare functions -fn spawn(val: T, f: extern fn(T)) { +fn spawn(val: T, f: extern fn(T)) { f(val); } diff --git a/src/test/run-pass/generic-alias-box.rs b/src/test/run-pass/generic-alias-box.rs index 3830d89616cb3..95902acc8487a 100644 --- a/src/test/run-pass/generic-alias-box.rs +++ b/src/test/run-pass/generic-alias-box.rs @@ -10,7 +10,7 @@ -fn id(t: T) -> T { return t; } +fn id(t: T) -> T { return t; } pub fn main() { let expected = @100; diff --git a/src/test/run-pass/generic-alias-unique.rs b/src/test/run-pass/generic-alias-unique.rs index 0aa1b4dd6510b..3cb6409a254e1 100644 --- a/src/test/run-pass/generic-alias-unique.rs +++ b/src/test/run-pass/generic-alias-unique.rs @@ -10,7 +10,7 @@ -fn id(t: T) -> T { return t; } +fn id(t: T) -> T { return t; } pub fn main() { let expected = ~100; diff --git a/src/test/run-pass/generic-box.rs b/src/test/run-pass/generic-box.rs index 05f4908b3b282..43c6acd3f3da0 100644 --- a/src/test/run-pass/generic-box.rs +++ b/src/test/run-pass/generic-box.rs @@ -10,7 +10,7 @@ -fn box(x: Box) -> @Box { return @x; } +fn box(x: Box) -> @Box { return @x; } struct Box {x: T, y: T, z: T} diff --git a/src/test/run-pass/generic-derived-type.rs b/src/test/run-pass/generic-derived-type.rs index 3667e54974590..264703439e810 100644 --- a/src/test/run-pass/generic-derived-type.rs +++ b/src/test/run-pass/generic-derived-type.rs @@ -10,11 +10,11 @@ -fn g(x: X) -> X { return x; } +fn g(x: X) -> X { return x; } struct Pair {a: T, b: T} -fn f(t: T) -> Pair { +fn f(t: T) -> Pair { let x: Pair = Pair {a: t, b: t}; return g::>(x); diff --git a/src/test/run-pass/generic-drop-glue.rs b/src/test/run-pass/generic-drop-glue.rs index b8de3e0b5e3cd..19e11197fd913 100644 --- a/src/test/run-pass/generic-drop-glue.rs +++ b/src/test/run-pass/generic-drop-glue.rs @@ -11,6 +11,6 @@ struct Pair { x: @int, y: @int } -fn f(t: T) { let t1: T = t; } +fn f(t: T) { let t1: T = t; } pub fn main() { let x = Pair {x: @10, y: @12}; f(x); } diff --git a/src/test/run-pass/generic-exterior-box.rs b/src/test/run-pass/generic-exterior-box.rs index 4c8de2fbffca4..7039fad1a9a2d 100644 --- a/src/test/run-pass/generic-exterior-box.rs +++ b/src/test/run-pass/generic-exterior-box.rs @@ -12,7 +12,7 @@ struct Recbox {x: @T} -fn reclift(t: T) -> Recbox { return Recbox {x: @t}; } +fn reclift(t: T) -> Recbox { return Recbox {x: @t}; } pub fn main() { let foo: int = 17; diff --git a/src/test/run-pass/generic-exterior-unique.rs b/src/test/run-pass/generic-exterior-unique.rs index 741d9f0e17943..3d3cc028f3583 100644 --- a/src/test/run-pass/generic-exterior-unique.rs +++ b/src/test/run-pass/generic-exterior-unique.rs @@ -10,7 +10,7 @@ struct Recbox {x: ~T} -fn reclift(t: T) -> Recbox { return Recbox {x: ~t}; } +fn reclift(t: T) -> Recbox { return Recbox {x: ~t}; } pub fn main() { let foo: int = 17; diff --git a/src/test/run-pass/generic-fn-infer.rs b/src/test/run-pass/generic-fn-infer.rs index 88130af2cccb2..fcd356bcd2d83 100644 --- a/src/test/run-pass/generic-fn-infer.rs +++ b/src/test/run-pass/generic-fn-infer.rs @@ -14,6 +14,6 @@ // -*- rust -*- // Issue #45: infer type parameters in function applications -fn id(x: T) -> T { return x; } +fn id(x: T) -> T { return x; } pub fn main() { let x: int = 42; let y: int = id(x); assert (x == y); } diff --git a/src/test/run-pass/generic-fn-unique.rs b/src/test/run-pass/generic-fn-unique.rs index b58b68ee5aea7..d41cd86bcc147 100644 --- a/src/test/run-pass/generic-fn-unique.rs +++ b/src/test/run-pass/generic-fn-unique.rs @@ -9,6 +9,6 @@ // except according to those terms. -fn f(x: ~T) -> ~T { return x; } +fn f(x: ~T) -> ~T { return x; } pub fn main() { let x = f(~3); log(debug, *x); } diff --git a/src/test/run-pass/generic-fn.rs b/src/test/run-pass/generic-fn.rs index 551fe221edaff..2fad81f4db20a 100644 --- a/src/test/run-pass/generic-fn.rs +++ b/src/test/run-pass/generic-fn.rs @@ -12,7 +12,7 @@ // -*- rust -*- -fn id(x: T) -> T { return x; } +fn id(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} diff --git a/src/test/run-pass/generic-tup.rs b/src/test/run-pass/generic-tup.rs index 8db1c4673bd4b..3f6f8e7af6881 100644 --- a/src/test/run-pass/generic-tup.rs +++ b/src/test/run-pass/generic-tup.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn get_third(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } +fn get_third(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } pub fn main() { log(debug, get_third((1, 2, 3))); diff --git a/src/test/run-pass/generic-unique.rs b/src/test/run-pass/generic-unique.rs index 0ae417e711e36..dc88f7acfbdf3 100644 --- a/src/test/run-pass/generic-unique.rs +++ b/src/test/run-pass/generic-unique.rs @@ -10,7 +10,7 @@ struct Triple { x: T, y: T, z: T } -fn box(x: Triple) -> ~Triple { return ~x; } +fn box(x: Triple) -> ~Triple { return ~x; } pub fn main() { let x: ~Triple = box::(Triple{x: 1, y: 2, z: 3}); diff --git a/src/test/run-pass/issue-2284.rs b/src/test/run-pass/issue-2284.rs index 1c4f21c628867..ebf7eec470c3e 100644 --- a/src/test/run-pass/issue-2284.rs +++ b/src/test/run-pass/issue-2284.rs @@ -12,7 +12,7 @@ trait Send { fn f(); } -fn f(t: T) { +fn f(t: T) { t.f(); } diff --git a/src/test/run-pass/issue-2288.rs b/src/test/run-pass/issue-2288.rs index 99c9828bfeaa0..375259baaf527 100644 --- a/src/test/run-pass/issue-2288.rs +++ b/src/test/run-pass/issue-2288.rs @@ -8,25 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait clam { +trait clam { fn chowder(y: A); } struct foo { x: A, } -impl clam for foo { +impl clam for foo { fn chowder(y: A) { } } -fn foo(b: A) -> foo { +fn foo(b: A) -> foo { foo { x: b } } -fn f(x: clam, a: A) { +fn f(x: clam, a: A) { x.chowder(a); } diff --git a/src/test/run-pass/issue-2311-2.rs b/src/test/run-pass/issue-2311-2.rs index 8e4036b36be6b..b4141b47b4d67 100644 --- a/src/test/run-pass/issue-2311-2.rs +++ b/src/test/run-pass/issue-2311-2.rs @@ -8,18 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait clam { } +trait clam { } struct foo { x: A, } -impl foo { +impl foo { fn bar>(c: C) -> B { fail!(); } } -fn foo(b: A) -> foo { +fn foo(b: A) -> foo { foo { x: b } diff --git a/src/test/run-pass/issue-2445-b.rs b/src/test/run-pass/issue-2445-b.rs index 2fce24c0670cf..9869b8d330bf1 100644 --- a/src/test/run-pass/issue-2445-b.rs +++ b/src/test/run-pass/issue-2445-b.rs @@ -12,18 +12,18 @@ struct c1 { x: T, } -impl c1 { +impl c1 { fn f1(x: int) { } } -fn c1(x: T) -> c1 { +fn c1(x: T) -> c1 { c1 { x: x } } -impl c1 { +impl c1 { fn f2(x: int) { } } diff --git a/src/test/run-pass/issue-2445.rs b/src/test/run-pass/issue-2445.rs index ea1cec61867e2..4a085a1eb8a97 100644 --- a/src/test/run-pass/issue-2445.rs +++ b/src/test/run-pass/issue-2445.rs @@ -12,17 +12,17 @@ struct c1 { x: T, } -impl c1 { +impl c1 { fn f1(x: T) {} } -fn c1(x: T) -> c1 { +fn c1(x: T) -> c1 { c1 { x: x } } -impl c1 { +impl c1 { fn f2(x: T) {} } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 8472f0158bb62..029fe12fcd984 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -34,7 +34,7 @@ pub mod pipes { mut payload: Option }; - pub fn packet() -> *packet { + pub fn packet() -> *packet { unsafe { let p: *packet = cast::transmute(~Stuff{ mut state: empty, @@ -70,7 +70,7 @@ pub mod pipes { } } - pub fn send(-p: send_packet, -payload: T) { + pub fn send(-p: send_packet, -payload: T) { let p = p.unwrap(); let p = unsafe { uniquify(p) }; assert (*p).payload.is_none(); @@ -96,7 +96,7 @@ pub mod pipes { } } - pub fn recv(-p: recv_packet) -> Option { + pub fn recv(-p: recv_packet) -> Option { let p = p.unwrap(); let p = unsafe { uniquify(p) }; loop { @@ -117,7 +117,7 @@ pub mod pipes { } } - pub fn sender_terminate(p: *packet) { + pub fn sender_terminate(p: *packet) { let p = unsafe { uniquify(p) }; match swap_state_rel(&mut (*p).state, terminated) { empty | blocked => { @@ -134,7 +134,7 @@ pub mod pipes { } } - pub fn receiver_terminate(p: *packet) { + pub fn receiver_terminate(p: *packet) { let p = unsafe { uniquify(p) }; match swap_state_rel(&mut (*p).state, terminated) { empty => { @@ -155,7 +155,7 @@ pub mod pipes { mut p: Option<*packet>, } - pub impl Drop for send_packet { + pub impl Drop for send_packet { fn finalize(&self) { if self.p != None { let mut p = None; @@ -165,7 +165,7 @@ pub mod pipes { } } - pub impl send_packet { + pub impl send_packet { fn unwrap() -> *packet { let mut p = None; p <-> self.p; @@ -173,7 +173,7 @@ pub mod pipes { } } - pub fn send_packet(p: *packet) -> send_packet { + pub fn send_packet(p: *packet) -> send_packet { send_packet { p: Some(p) } @@ -183,7 +183,7 @@ pub mod pipes { mut p: Option<*packet>, } - pub impl Drop for recv_packet { + pub impl Drop for recv_packet { fn finalize(&self) { if self.p != None { let mut p = None; @@ -193,7 +193,7 @@ pub mod pipes { } } - pub impl recv_packet { + pub impl recv_packet { fn unwrap() -> *packet { let mut p = None; p <-> self.p; @@ -201,13 +201,13 @@ pub mod pipes { } } - pub fn recv_packet(p: *packet) -> recv_packet { + pub fn recv_packet(p: *packet) -> recv_packet { recv_packet { p: Some(p) } } - pub fn entangle() -> (send_packet, recv_packet) { + pub fn entangle() -> (send_packet, recv_packet) { let p = packet(); (send_packet(p), recv_packet(p)) } diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index ed7b032e7139e..45c6b22544d9c 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -11,7 +11,7 @@ trait hax { } impl hax for A { } -fn perform_hax(x: @T) -> hax { +fn perform_hax(x: @T) -> hax { x as hax } diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index 8a6f2a0b461bf..7c87c6a31cde1 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -11,7 +11,7 @@ trait hax { } impl hax for A { } -fn perform_hax(x: @T) -> hax { +fn perform_hax(x: @T) -> hax { x as hax } diff --git a/src/test/run-pass/issue-2834.rs b/src/test/run-pass/issue-2834.rs index 84e0f20e61b11..579c4f9f1d124 100644 --- a/src/test/run-pass/issue-2834.rs +++ b/src/test/run-pass/issue-2834.rs @@ -12,7 +12,7 @@ // proto! streamp ( - open:send { + open:send { data(T) -> open } ) diff --git a/src/test/run-pass/issue-3305.rs b/src/test/run-pass/issue-3305.rs index 53dd6f942e860..b44d1cbb78d48 100644 --- a/src/test/run-pass/issue-3305.rs +++ b/src/test/run-pass/issue-3305.rs @@ -16,7 +16,7 @@ impl double for uint { fn double() -> uint { self * 2u } } -fn is_equal(x: @D, exp: uint) { +fn is_equal(x: @D, exp: uint) { assert x.double() == exp; } diff --git a/src/test/run-pass/issue-333.rs b/src/test/run-pass/issue-333.rs index 8b863bd90b64d..1f9dd6e3b6f3c 100644 --- a/src/test/run-pass/issue-333.rs +++ b/src/test/run-pass/issue-333.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn quux(x: T) -> T { let f = id::; return f(x); } +fn quux(x: T) -> T { let f = id::; return f(x); } -fn id(x: T) -> T { return x; } +fn id(x: T) -> T { return x; } pub fn main() { assert (quux(10) == 10); } diff --git a/src/test/run-pass/issue-3480.rs b/src/test/run-pass/issue-3480.rs index 252ebb86685ec..e813cde7c2760 100644 --- a/src/test/run-pass/issue-3480.rs +++ b/src/test/run-pass/issue-3480.rs @@ -9,14 +9,14 @@ // except according to those terms. // xfail-test -type IMap = ~[(K, V)]; +type IMap = ~[(K, V)]; -trait ImmutableMap +trait ImmutableMap { pure fn contains_key(key: K) -> bool; } -impl IMap : ImmutableMap +impl IMap : ImmutableMap { pure fn contains_key(key: K) -> bool { diff --git a/src/test/run-pass/issue-4016.rs b/src/test/run-pass/issue-4016.rs index 307d7974762f7..69cd1a2a19d86 100644 --- a/src/test/run-pass/issue-4016.rs +++ b/src/test/run-pass/issue-4016.rs @@ -18,7 +18,7 @@ use std::serialization::{Deserializable, deserialize}; trait JD : Deserializable { } //type JD = Deserializable; -fn exec() { +fn exec() { let doc = result::unwrap(json::from_str("")); let _v: T = deserialize(&json::Deserializer(doc)); fail!() diff --git a/src/test/run-pass/ivec-add.rs b/src/test/run-pass/ivec-add.rs index f06185f37272e..aa61a35d6e350 100644 --- a/src/test/run-pass/ivec-add.rs +++ b/src/test/run-pass/ivec-add.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn double(a: T) -> ~[T] { return ~[a] + ~[a]; } +fn double(a: T) -> ~[T] { return ~[a] + ~[a]; } fn double_int(a: int) -> ~[int] { return ~[a] + ~[a]; } diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 9447330fe07ed..5a3adc14e433b 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -12,11 +12,11 @@ #[legacy_modes]; trait vec_monad { - fn bind(f: fn(A) -> ~[B]) -> ~[B]; + fn bind(f: fn(A) -> ~[B]) -> ~[B]; } impl vec_monad for ~[A] { - fn bind(f: fn(A) -> ~[B]) -> ~[B] { + fn bind(f: fn(A) -> ~[B]) -> ~[B] { let mut r = ~[]; for self.each |elt| { r += f(*elt); } r diff --git a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs index b5af07207bccd..88c317a3c0735 100644 --- a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs +++ b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs @@ -14,17 +14,17 @@ trait Serializer { } trait Serializable { - fn serialize(s: S); + fn serialize(s: S); } impl Serializable for int { - fn serialize(_s: S) { } + fn serialize(_s: S) { } } struct F { a: A } -impl Serializable for F { - fn serialize(s: S) { +impl Serializable for F { + fn serialize(s: S) { self.a.serialize(s); } } diff --git a/src/test/run-pass/newtype-polymorphic.rs b/src/test/run-pass/newtype-polymorphic.rs index dfa1008a69e30..01e554ad04128 100644 --- a/src/test/run-pass/newtype-polymorphic.rs +++ b/src/test/run-pass/newtype-polymorphic.rs @@ -10,9 +10,9 @@ enum myvec = ~[X]; -fn myvec_deref(mv: myvec) -> ~[X] { return copy *mv; } +fn myvec_deref(mv: myvec) -> ~[X] { return copy *mv; } -fn myvec_elt(mv: myvec) -> X { return mv[0]; } +fn myvec_elt(mv: myvec) -> X { return mv[0]; } pub fn main() { let mv = myvec(~[1, 2, 3]); diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index 3fb9a557fa18c..931c4cbad79c4 100644 --- a/src/test/run-pass/non-boolean-pure-fns.rs +++ b/src/test/run-pass/non-boolean-pure-fns.rs @@ -14,15 +14,15 @@ extern mod std; use std::list::*; -pure fn pure_length_go(ls: @List, acc: uint) -> uint { +pure fn pure_length_go(ls: @List, acc: uint) -> uint { match *ls { Nil => { acc } Cons(_, tl) => { pure_length_go(tl, acc + 1u) } } } -pure fn pure_length(ls: @List) -> uint { pure_length_go(ls, 0u) } +pure fn pure_length(ls: @List) -> uint { pure_length_go(ls, 0u) } -pure fn nonempty_list(ls: @List) -> bool { pure_length(ls) > 0u } +pure fn nonempty_list(ls: @List) -> bool { pure_length(ls) > 0u } -fn safe_head(ls: @List) -> T { +fn safe_head(ls: @List) -> T { assert !is_empty(ls); return head(ls); } diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index bc218e71ede9b..0016d792c0d0f 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -47,7 +47,7 @@ macro_rules! move_it ( { $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } } ) -fn switch(+endp: pipes::RecvPacket, +fn switch(+endp: pipes::RecvPacket, f: fn(+v: Option) -> U) -> U { f(pipes::try_recv(endp)) } diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index 3694ffdfde02f..890599f9b8bf4 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -31,7 +31,7 @@ fn align(size: uint, align: uint) -> uint { enum ptr_visit_adaptor = Inner; -impl ptr_visit_adaptor { +impl ptr_visit_adaptor { #[inline(always)] fn bump(sz: uint) { @@ -59,7 +59,7 @@ impl ptr_visit_adaptor { } -impl TyVisitor for ptr_visit_adaptor { +impl TyVisitor for ptr_visit_adaptor { fn visit_bot(&self) -> bool { self.align_to::<()>(); diff --git a/src/test/run-pass/resource-generic.rs b/src/test/run-pass/resource-generic.rs index eb25f20607f41..347c14538a10d 100644 --- a/src/test/run-pass/resource-generic.rs +++ b/src/test/run-pass/resource-generic.rs @@ -17,13 +17,13 @@ struct finish { arg: Arg } -impl Drop for finish { +impl Drop for finish { fn finalize(&self) { (self.arg.fin)(self.arg.val); } } -fn finish(arg: Arg) -> finish { +fn finish(arg: Arg) -> finish { finish { arg: arg } diff --git a/src/test/run-pass/ret-break-cont-in-block.rs b/src/test/run-pass/ret-break-cont-in-block.rs index 97fa11bef1b2a..e70c72f550d0d 100644 --- a/src/test/run-pass/ret-break-cont-in-block.rs +++ b/src/test/run-pass/ret-break-cont-in-block.rs @@ -21,7 +21,7 @@ fn iter(v: ~[T], it: fn(T) -> bool) { } } -fn find_pos(n: T, h: ~[T]) -> Option { +fn find_pos(n: T, h: ~[T]) -> Option { let mut i = 0u; for iter(copy h) |e| { if e == n { return Some(i); } diff --git a/src/test/run-pass/ret-none.rs b/src/test/run-pass/ret-none.rs index 1df01a5e57933..d493f23ba8400 100644 --- a/src/test/run-pass/ret-none.rs +++ b/src/test/run-pass/ret-none.rs @@ -12,6 +12,6 @@ enum option { none, some(T), } -fn f() -> option { return none; } +fn f() -> option { return none; } pub fn main() { f::(); } diff --git a/src/test/run-pass/send-type-inference.rs b/src/test/run-pass/send-type-inference.rs index bf1ab6e07d2e5..77f0614036941 100644 --- a/src/test/run-pass/send-type-inference.rs +++ b/src/test/run-pass/send-type-inference.rs @@ -13,7 +13,7 @@ use core::pipes::*; // tests that ctrl's type gets inferred properly type command = {key: K, val: V}; -fn cache_server(c: Chan>>) { +fn cache_server(c: Chan>>) { let (ctrl_port, ctrl_chan) = stream(); c.send(ctrl_chan); } diff --git a/src/test/run-pass/sendfn-generic-fn.rs b/src/test/run-pass/sendfn-generic-fn.rs index be4b609afab10..2dc008931e490 100644 --- a/src/test/run-pass/sendfn-generic-fn.rs +++ b/src/test/run-pass/sendfn-generic-fn.rs @@ -15,7 +15,7 @@ pub fn main() { test05(); } struct Pair { a: A, b: B } -fn make_generic_record(a: A, b: B) -> Pair { +fn make_generic_record(a: A, b: B) -> Pair { return Pair {a: a, b: b}; } @@ -31,7 +31,7 @@ fn test05_start(&&f: fn~(&&v: float, &&v: ~str) -> Pair) { assert q.b == ~"Ho"; } -fn spawn(f: extern fn(fn~(A,B)->Pair)) { +fn spawn(f: extern fn(fn~(A,B)->Pair)) { let arg = fn~(a: A, b: B) -> Pair { return make_generic_record(a, b); }; diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 5e7785c2dbbe8..5cc54da28b22c 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -41,13 +41,13 @@ impl uint_utils for uint { trait vec_utils { fn length_() -> uint; fn iter_(f: fn(T)); - fn map_(f: fn(T) -> U) -> ~[U]; + fn map_(f: fn(T) -> U) -> ~[U]; } impl vec_utils for ~[T] { fn length_() -> uint { vec::len(self) } fn iter_(f: fn(T)) { for self.each |x| { f(*x); } } - fn map_(f: fn(T) -> U) -> ~[U] { + fn map_(f: fn(T) -> U) -> ~[U] { let mut r = ~[]; for self.each |elt| { r += ~[f(*elt)]; } r diff --git a/src/test/run-pass/static-method-in-trait-with-tps-intracrate.rs b/src/test/run-pass/static-method-in-trait-with-tps-intracrate.rs index 328a937b441fe..9a9533d7c8a3b 100644 --- a/src/test/run-pass/static-method-in-trait-with-tps-intracrate.rs +++ b/src/test/run-pass/static-method-in-trait-with-tps-intracrate.rs @@ -12,11 +12,11 @@ trait Deserializer { fn read_int() -> int; } -trait Deserializable { +trait Deserializable { static fn deserialize(d: &D) -> Self; } -impl Deserializable for int { +impl Deserializable for int { static fn deserialize(d: &D) -> int { return d.read_int(); } diff --git a/src/test/run-pass/static-method-test.rs b/src/test/run-pass/static-method-test.rs index da79bf53fe06c..d9461c48be8a8 100644 --- a/src/test/run-pass/static-method-test.rs +++ b/src/test/run-pass/static-method-test.rs @@ -17,7 +17,7 @@ trait bool_like { static fn select(b: Self, +x1: A, +x2: A) -> A; } -fn andand(x1: T, x2: T) -> T { +fn andand(x1: T, x2: T) -> T { bool_like::select(x1, x2, x1) } @@ -70,7 +70,7 @@ fn map, U, BU: buildable> } } -fn seq_range>(lo: uint, hi: uint) -> BT { +fn seq_range>(lo: uint, hi: uint) -> BT { do buildable::build_sized(hi-lo) |push| { for uint::range(lo, hi) |i| { push(i as int); diff --git a/src/test/run-pass/trait-bounds.rs b/src/test/run-pass/trait-bounds.rs index 2e093d6d63163..1775bba934c93 100644 --- a/src/test/run-pass/trait-bounds.rs +++ b/src/test/run-pass/trait-bounds.rs @@ -12,7 +12,7 @@ trait connection { fn read() -> int; } -trait connection_factory { +trait connection_factory { fn create() -> C; } diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index 62d1c00eea944..e0e3c6e15975c 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -21,7 +21,7 @@ trait to_str { fn to_str() -> ~str; } -impl to_str for Option { +impl to_str for Option { fn to_str() -> ~str { match self { None => { ~"none" } @@ -42,7 +42,7 @@ impl to_str for Tree { } } -fn foo(x: T) -> ~str { x.to_str() } +fn foo(x: T) -> ~str { x.to_str() } pub fn main() { let t1 = Tree(@TreeR{mut left: None, diff --git a/src/test/run-pass/trait-default-method-bound.rs b/src/test/run-pass/trait-default-method-bound.rs index ab2f1928d1f30..be50b4340553c 100644 --- a/src/test/run-pass/trait-default-method-bound.rs +++ b/src/test/run-pass/trait-default-method-bound.rs @@ -16,7 +16,7 @@ trait A { impl A for int { } -fn f(i: T) { +fn f(i: T) { assert i.g() == 10; } diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index 80b1b1eba39ef..ff902490e7c27 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -25,10 +25,10 @@ impl to_str for () { } trait map { - fn map(f: fn(T) -> U) -> ~[U]; + fn map(f: fn(T) -> U) -> ~[U]; } impl map for ~[T] { - fn map(f: fn(T) -> U) -> ~[U] { + fn map(f: fn(T) -> U) -> ~[U] { let mut r = ~[]; for self.each |x| { r += ~[f(*x)]; } r @@ -38,7 +38,7 @@ impl map for ~[T] { fn foo>(x: T) -> ~[~str] { x.map(|_e| ~"hi" ) } -fn bar>(x: T) -> ~[~str] { +fn bar>(x: T) -> ~[~str] { x.map(|_e| _e.to_str() ) } diff --git a/src/test/run-pass/trait-inheritance-auto-xc-2.rs b/src/test/run-pass/trait-inheritance-auto-xc-2.rs index b8e060ee91431..c3333fa10ab17 100644 --- a/src/test/run-pass/trait-inheritance-auto-xc-2.rs +++ b/src/test/run-pass/trait-inheritance-auto-xc-2.rs @@ -18,9 +18,9 @@ use aux::{Foo, Bar, Baz, A}; // We want to extend all Foo, Bar, Bazes to Quuxes pub trait Quux: Foo Bar Baz { } -impl Quux for T { } +impl Quux for T { } -fn f(a: &T) { +fn f(a: &T) { assert a.f() == 10; assert a.g() == 20; assert a.h() == 30; diff --git a/src/test/run-pass/trait-inheritance-auto-xc.rs b/src/test/run-pass/trait-inheritance-auto-xc.rs index f0fa291f00c15..302076da7a221 100644 --- a/src/test/run-pass/trait-inheritance-auto-xc.rs +++ b/src/test/run-pass/trait-inheritance-auto-xc.rs @@ -21,7 +21,7 @@ impl Foo for A { fn f() -> int { 10 } } impl Bar for A { fn g() -> int { 20 } } impl Baz for A { fn h() -> int { 30 } } -fn f(a: &T) { +fn f(a: &T) { assert a.f() == 10; assert a.g() == 20; assert a.h() == 30; diff --git a/src/test/run-pass/trait-inheritance-auto.rs b/src/test/run-pass/trait-inheritance-auto.rs index 84e498c8ffd11..5d576193880e5 100644 --- a/src/test/run-pass/trait-inheritance-auto.rs +++ b/src/test/run-pass/trait-inheritance-auto.rs @@ -10,7 +10,7 @@ // Testing that this impl turns A into a Quux, because // A is already a Foo Bar Baz -impl Quux for T { } +impl Quux for T { } trait Foo { fn f() -> int; } trait Bar { fn g() -> int; } @@ -24,7 +24,7 @@ impl Foo for A { fn f() -> int { 10 } } impl Bar for A { fn g() -> int { 20 } } impl Baz for A { fn h() -> int { 30 } } -fn f(a: &T) { +fn f(a: &T) { assert a.f() == 10; assert a.g() == 20; assert a.h() == 30; diff --git a/src/test/run-pass/trait-inheritance-call-bound-inherited2.rs b/src/test/run-pass/trait-inheritance-call-bound-inherited2.rs index 45498996ba552..11a0918ba78c0 100644 --- a/src/test/run-pass/trait-inheritance-call-bound-inherited2.rs +++ b/src/test/run-pass/trait-inheritance-call-bound-inherited2.rs @@ -20,7 +20,7 @@ impl Baz for A { fn h() -> int { 30 } } // Call a function on Foo, given a T: Baz, // which is inherited via Bar -fn gg(a: &T) -> int { +fn gg(a: &T) -> int { a.f() } diff --git a/src/test/run-pass/trait-inheritance-diamond.rs b/src/test/run-pass/trait-inheritance-diamond.rs index 1c914ebabc0a2..1d6e482309178 100644 --- a/src/test/run-pass/trait-inheritance-diamond.rs +++ b/src/test/run-pass/trait-inheritance-diamond.rs @@ -22,7 +22,7 @@ impl B for S { fn b(&self) -> int { 20 } } impl C for S { fn c(&self) -> int { 30 } } impl D for S { fn d(&self) -> int { 40 } } -fn f(x: &T) { +fn f(x: &T) { assert x.a() == 10; assert x.b() == 20; assert x.c() == 30; diff --git a/src/test/run-pass/trait-inheritance-multiple-inheritors.rs b/src/test/run-pass/trait-inheritance-multiple-inheritors.rs index afcf5c87832ac..ad4d3ebc0b577 100644 --- a/src/test/run-pass/trait-inheritance-multiple-inheritors.rs +++ b/src/test/run-pass/trait-inheritance-multiple-inheritors.rs @@ -19,7 +19,7 @@ impl B for S { fn b(&self) -> int { 20 } } impl C for S { fn c(&self) -> int { 30 } } // Both B and C inherit from A -fn f(x: &T) { +fn f(x: &T) { assert x.a() == 10; assert x.b() == 20; assert x.c() == 30; diff --git a/src/test/run-pass/trait-inheritance-multiple-params.rs b/src/test/run-pass/trait-inheritance-multiple-params.rs index a91a40ce2212a..5b6a754488efb 100644 --- a/src/test/run-pass/trait-inheritance-multiple-params.rs +++ b/src/test/run-pass/trait-inheritance-multiple-params.rs @@ -19,7 +19,7 @@ impl B for S { fn b(&self) -> int { 20 } } impl C for S { fn c(&self) -> int { 30 } } // Multiple type params, multiple levels of inheritance -fn f(x: &X, y: &Y, z: &Z) { +fn f(x: &X, y: &Y, z: &Z) { assert x.a() == 10; assert y.a() == 10; assert y.b() == 20; diff --git a/src/test/run-pass/trait-inheritance-overloading-xc-exe.rs b/src/test/run-pass/trait-inheritance-overloading-xc-exe.rs index f779850787160..1d59f1fc19e13 100644 --- a/src/test/run-pass/trait-inheritance-overloading-xc-exe.rs +++ b/src/test/run-pass/trait-inheritance-overloading-xc-exe.rs @@ -14,7 +14,7 @@ extern mod trait_inheritance_overloading_xc; use trait_inheritance_overloading_xc::{MyNum, MyInt}; -fn f(x: T, y: T) -> (T, T, T) { +fn f(x: T, y: T) -> (T, T, T) { return (x + y, x - y, x * y); } diff --git a/src/test/run-pass/trait-inheritance-overloading.rs b/src/test/run-pass/trait-inheritance-overloading.rs index f56a950f918ce..08f3d41ddad9b 100644 --- a/src/test/run-pass/trait-inheritance-overloading.rs +++ b/src/test/run-pass/trait-inheritance-overloading.rs @@ -33,7 +33,7 @@ impl Eq for MyInt { impl MyNum for MyInt; -fn f(x: T, y: T) -> (T, T, T) { +fn f(x: T, y: T) -> (T, T, T) { return (x + y, x - y, x * y); } diff --git a/src/test/run-pass/trait-inheritance-visibility.rs b/src/test/run-pass/trait-inheritance-visibility.rs index 6015eff8abe24..8518137bbb829 100644 --- a/src/test/run-pass/trait-inheritance-visibility.rs +++ b/src/test/run-pass/trait-inheritance-visibility.rs @@ -15,11 +15,11 @@ mod traits { } trait Quux: traits::Foo { } -impl Quux for T { } +impl Quux for T { } // Foo is not in scope but because Quux is we can still access // Foo's methods on a Quux bound typaram -fn f(x: &T) { +fn f(x: &T) { assert x.f() == 10; } diff --git a/src/test/run-pass/trait-inheritance2.rs b/src/test/run-pass/trait-inheritance2.rs index 08448a65ac805..55a63e9099a93 100644 --- a/src/test/run-pass/trait-inheritance2.rs +++ b/src/test/run-pass/trait-inheritance2.rs @@ -21,7 +21,7 @@ impl Bar for A { fn g() -> int { 20 } } impl Baz for A { fn h() -> int { 30 } } impl Quux for A; -fn f(a: &T) { +fn f(a: &T) { assert a.f() == 10; assert a.g() == 20; assert a.h() == 30; diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index b3ebc2ba820aa..20e23c0fc58e7 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -24,7 +24,7 @@ impl to_str for int { fn to_str() -> ~str { int::str(self) } } -impl to_str for ~[T] { +impl to_str for ~[T] { fn to_str() -> ~str { ~"[" + str::connect(vec::map(self, |e| e.to_str() ), ~", ") + ~"]" } @@ -34,12 +34,12 @@ pub fn main() { assert 1.to_str() == ~"1"; assert (~[2, 3, 4]).to_str() == ~"[2, 3, 4]"; - fn indirect(x: T) -> ~str { + fn indirect(x: T) -> ~str { x.to_str() + ~"!" } assert indirect(~[10, 20]) == ~"[10, 20]!"; - fn indirect2(x: T) -> ~str { + fn indirect2(x: T) -> ~str { indirect(x) } assert indirect2(~[1]) == ~"[1]!"; diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index 95920bcc967d3..684e0a8aaaed8 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -12,8 +12,8 @@ #[legacy_modes]; fn p_foo(pinned: T) { } -fn s_foo(shared: T) { } -fn u_foo(unique: T) { } +fn s_foo(shared: T) { } +fn u_foo(unique: T) { } struct r { i: int, diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs index 8de91acd18542..dd86150b93bf9 100644 --- a/src/test/run-pass/uniq-cc-generic.rs +++ b/src/test/run-pass/uniq-cc-generic.rs @@ -18,7 +18,7 @@ struct Pointy { d : fn~() -> uint, } -fn make_uniq_closure(a: A) -> fn~() -> uint { +fn make_uniq_closure(a: A) -> fn~() -> uint { fn~() -> uint { ptr::addr_of(&a) as uint } } diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index 9ad5575be9dad..d6992e4623fd0 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(t: T) -> T { +fn f(t: T) -> T { let t1 = t; t1 } diff --git a/src/test/run-pass/unique-generic-assign.rs b/src/test/run-pass/unique-generic-assign.rs index 5d3b550c4304a..ab92b10a3320b 100644 --- a/src/test/run-pass/unique-generic-assign.rs +++ b/src/test/run-pass/unique-generic-assign.rs @@ -10,7 +10,7 @@ // Issue #976 -fn f(x: ~T) { +fn f(x: ~T) { let _x2 = x; } pub fn main() { } diff --git a/src/test/run-pass/unique-kinds.rs b/src/test/run-pass/unique-kinds.rs index 0cffa14fb70e5..180ce716dcc9d 100644 --- a/src/test/run-pass/unique-kinds.rs +++ b/src/test/run-pass/unique-kinds.rs @@ -12,11 +12,11 @@ use cmp::Eq; fn sendable() { - fn f(i: T, j: T) { + fn f(i: T, j: T) { assert i == j; } - fn g(i: T, j: T) { + fn g(i: T, j: T) { assert i != j; } @@ -30,11 +30,11 @@ fn sendable() { fn copyable() { - fn f(i: T, j: T) { + fn f(i: T, j: T) { assert i == j; } - fn g(i: T, j: T) { + fn g(i: T, j: T) { assert i != j; } @@ -48,11 +48,11 @@ fn copyable() { fn noncopyable() { - fn f(i: T, j: T) { + fn f(i: T, j: T) { assert i == j; } - fn g(i: T, j: T) { + fn g(i: T, j: T) { assert i != j; }