Permalink
Browse files

librustc: Replace all uses of `fn()` with `&fn()`. rs=defun

  • Loading branch information...
1 parent 51cdca0 commit d18f7854578e8c2e1d7dce90db6e3b5cf9befba9 @pcwalton pcwalton committed Mar 7, 2013
Showing with 813 additions and 812 deletions.
  1. +1 −1 src/compiletest/header.rs
  2. +1 −1 src/compiletest/runtest.rs
  3. +3 −3 src/libcore/at_vec.rs
  4. +1 −1 src/libcore/bool.rs
  5. +1 −1 src/libcore/cell.rs
  6. +1 −1 src/libcore/cleanup.rs
  7. +6 −6 src/libcore/container.rs
  8. +1 −1 src/libcore/dlist.rs
  9. +3 −3 src/libcore/either.rs
  10. +12 −12 src/libcore/hashmap.rs
  11. +15 −15 src/libcore/io.rs
  12. +26 −26 src/libcore/iter.rs
  13. +4 −4 src/libcore/num/int-template.rs
  14. +4 −4 src/libcore/num/uint-template.rs
  15. +2 −2 src/libcore/num/uint-template/uint.rs
  16. +15 −15 src/libcore/option.rs
  17. +6 −6 src/libcore/os.rs
  18. +1 −1 src/libcore/pipes.rs
  19. +1 −1 src/libcore/ptr.rs
  20. +1 −1 src/libcore/reflect.rs
  21. +2 −2 src/libcore/repr.rs
  22. +16 −16 src/libcore/result.rs
  23. +4 −4 src/libcore/run.rs
  24. +2 −2 src/libcore/stackwalk.rs
  25. +47 −47 src/libcore/str.rs
  26. +2 −2 src/libcore/sys.rs
  27. +1 −1 src/libcore/task/local_data.rs
  28. +1 −1 src/libcore/task/local_data_priv.rs
  29. +4 −4 src/libcore/task/mod.rs
  30. +6 −6 src/libcore/task/spawn.rs
  31. +12 −12 src/libcore/trie.rs
  32. +3 −3 src/libcore/unstable.rs
  33. +114 −112 src/libcore/vec.rs
  34. +1 −1 src/libfuzzer/fuzzer.rc
  35. +1 −1 src/librustc/back/link.rs
  36. +1 −1 src/librustc/driver/driver.rs
  37. +1 −1 src/librustc/driver/session.rs
  38. +1 −1 src/librustc/metadata/csearch.rs
  39. +1 −1 src/librustc/metadata/cstore.rs
  40. +5 −5 src/librustc/metadata/decoder.rs
  41. +1 −1 src/librustc/metadata/encoder.rs
  42. +1 −1 src/librustc/metadata/tydecode.rs
  43. +1 −1 src/librustc/metadata/tyencode.rs
  44. +2 −2 src/librustc/middle/astencode.rs
  45. +1 −1 src/librustc/middle/borrowck/mod.rs
  46. +1 −1 src/librustc/middle/kind.rs
  47. +1 −1 src/librustc/middle/lint.rs
  48. +6 −7 src/librustc/middle/liveness.rs
  49. +1 −1 src/librustc/middle/mem_categorization.rs
  50. +1 −1 src/librustc/middle/pat_util.rs
  51. +4 −4 src/librustc/middle/resolve.rs
  52. +10 −10 src/librustc/middle/trans/base.rs
  53. +1 −1 src/librustc/middle/trans/cabi.rs
  54. +1 −1 src/librustc/middle/trans/cabi_x86_64.rs
  55. +1 −1 src/librustc/middle/trans/callee.rs
  56. +1 −1 src/librustc/middle/trans/datum.rs
  57. +1 −1 src/librustc/middle/trans/debuginfo.rs
  58. +1 −1 src/librustc/middle/trans/expr.rs
  59. +18 −18 src/librustc/middle/ty.rs
  60. +2 −2 src/librustc/middle/typeck/astconv.rs
  61. +1 −1 src/librustc/middle/typeck/check/demand.rs
  62. +2 −2 src/librustc/middle/typeck/check/mod.rs
  63. +3 −3 src/librustc/middle/typeck/check/regionmanip.rs
  64. +1 −1 src/librustc/middle/typeck/infer/glb.rs
  65. +8 −8 src/librustc/middle/typeck/infer/mod.rs
  66. +15 −15 src/librustc/middle/typeck/infer/region_inference.rs
  67. +1 −1 src/librustc/middle/typeck/mod.rs
  68. +1 −1 src/librustc/util/common.rs
  69. +1 −1 src/librustdoc/rustdoc.rc
  70. +1 −1 src/librusti/rusti.rc
  71. +1 −1 src/librustpkg/util.rs
  72. +8 −8 src/libstd/arc.rs
  73. +3 −3 src/libstd/arena.rs
  74. +15 −15 src/libstd/bitv.rs
  75. +35 −35 src/libstd/ebml.rs
  76. +1 −1 src/libstd/fun_treemap.rs
  77. +43 −43 src/libstd/json.rs
  78. +4 −4 src/libstd/list.rs
  79. +1 −1 src/libstd/md4.rs
  80. +7 −7 src/libstd/oldmap.rs
  81. +15 −15 src/libstd/prettyprint.rs
  82. +1 −1 src/libstd/priority_queue.rs
  83. +5 −5 src/libstd/rope.rs
  84. +1 −1 src/libstd/semver.rs
  85. +32 −32 src/libstd/serialize.rs
  86. +6 −6 src/libstd/smallintmap.rs
  87. +16 −16 src/libstd/sync.rs
  88. +16 −16 src/libstd/treemap.rs
  89. +1 −1 src/libstd/workcache.rs
  90. +1 −1 src/libsyntax/ast_map.rs
  91. +1 −1 src/libsyntax/ast_util.rs
  92. +1 −1 src/libsyntax/diagnostic.rs
  93. +16 −16 src/libsyntax/ext/auto_encode.rs
  94. +1 −1 src/libsyntax/ext/pipes/proto.rs
  95. +10 −10 src/libsyntax/opt_vec.rs
  96. +6 −6 src/libsyntax/parse/common.rs
  97. +1 −1 src/libsyntax/parse/mod.rs
  98. +3 −3 src/libsyntax/parse/parser.rs
  99. +2 −2 src/libsyntax/print/pprust.rs
  100. +2 −2 src/test/auxiliary/cci_impl_lib.rs
  101. +1 −1 src/test/auxiliary/cci_iter_lib.rs
  102. +1 −1 src/test/auxiliary/cci_no_inline_lib.rs
  103. +1 −1 src/test/bench/core-map.rs
  104. +3 −3 src/test/bench/core-set.rs
  105. +1 −1 src/test/bench/core-std.rs
  106. +2 −2 src/test/bench/pingpong.rs
  107. +1 −1 src/test/bench/shootout-k-nucleotide-pipes.rs
  108. +1 −1 src/test/compile-fail/arg-style-mismatch.rs
  109. +1 −1 src/test/compile-fail/bad-for-loop.rs
  110. +3 −3 src/test/compile-fail/block-coerce-no.rs
  111. +1 −1 src/test/compile-fail/borrowck-assign-comp-idx.rs
  112. +1 −1 src/test/compile-fail/borrowck-autoref-3261.rs
  113. +1 −1 src/test/compile-fail/borrowck-insert-during-each.rs
  114. +1 −1 src/test/compile-fail/borrowck-lend-flow.rs
  115. +1 −1 src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
  116. +1 −1 src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
  117. +2 −2 src/test/compile-fail/borrowck-loan-rcvr.rs
  118. +2 −2 src/test/compile-fail/borrowck-loan-vec-content.rs
  119. +1 −1 src/test/compile-fail/closure-that-fails.rs
  120. +1 −1 src/test/compile-fail/extern-wrong-value-type.rs
  121. +1 −1 src/test/compile-fail/fn-variance-1.rs
  122. +1 −1 src/test/compile-fail/immut-function-arguments.rs
  123. +2 −2 src/test/compile-fail/issue-2149.rs
  124. +1 −1 src/test/compile-fail/issue-2817-2.rs
  125. +1 −1 src/test/compile-fail/liveness-closure-require-ret.rs
  126. +1 −1 src/test/compile-fail/missing-do.rs
  127. +2 −2 src/test/compile-fail/mode-inference-fail.rs
  128. +3 −3 src/test/compile-fail/pure-higher-order.rs
  129. +1 −1 src/test/compile-fail/purity-infer-fail.rs
  130. +1 −1 src/test/compile-fail/qquote-1.rs
  131. +1 −1 src/test/compile-fail/qquote-2.rs
  132. +1 −1 src/test/compile-fail/regions-creating-enums.rs
  133. +1 −1 src/test/compile-fail/regions-escape-bound-fn-2.rs
  134. +1 −1 src/test/compile-fail/regions-escape-bound-fn.rs
  135. +1 −1 src/test/compile-fail/regions-escape-via-trait-or-not.rs
  136. +1 −1 src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
  137. +1 −1 src/test/compile-fail/regions-infer-call-3.rs
  138. +1 −1 src/test/compile-fail/regions-ret-borrowed-1.rs
  139. +1 −1 src/test/compile-fail/regions-ret-borrowed.rs
  140. +1 −1 src/test/compile-fail/regions-scoping.rs
  141. +1 −1 src/test/compile-fail/type-arg-out-of-scope.rs
  142. +1 −1 src/test/run-fail/unwind-iter.rs
  143. +1 −1 src/test/run-fail/unwind-iter2.rs
  144. +1 −1 src/test/run-pass-fulldeps/qquote.rs
  145. +1 −1 src/test/run-pass/alt-phi.rs
  146. +3 −3 src/test/run-pass/assignability-trait.rs
  147. +2 −2 src/test/run-pass/autobind.rs
  148. +1 −1 src/test/run-pass/block-arg-can-be-followed-by-block-arg.rs
  149. +1 −1 src/test/run-pass/block-arg-used-as-any.rs
  150. +1 −1 src/test/run-pass/block-explicit-types.rs
  151. +1 −1 src/test/run-pass/block-fn-coerce.rs
  152. +1 −1 src/test/run-pass/block-iter-1.rs
  153. +1 −1 src/test/run-pass/block-iter-2.rs
  154. +1 −1 src/test/run-pass/borrowck-borrow-from-expr-block.rs
  155. +1 −1 src/test/run-pass/borrowck-mut-uniq.rs
  156. +1 −1 src/test/run-pass/borrowck-preserve-box-in-field.rs
  157. +1 −1 src/test/run-pass/borrowck-preserve-box-in-uniq.rs
  158. +1 −1 src/test/run-pass/borrowck-preserve-box.rs
  159. +1 −1 src/test/run-pass/borrowck-preserve-expl-deref.rs
  160. +3 −3 src/test/run-pass/class-impl-parameterized-trait.rs
  161. +3 −3 src/test/run-pass/class-impl-very-parameterized-trait.rs
  162. +2 −2 src/test/run-pass/class-trait-bounded-param.rs
  163. +1 −1 src/test/run-pass/closure-inference.rs
  164. +1 −1 src/test/run-pass/do-for-empty-args.rs
  165. +1 −1 src/test/run-pass/do-pure.rs
  166. +1 −1 src/test/run-pass/fn-assign-managed-to-bare-1.rs
  167. +1 −1 src/test/run-pass/fn-bare-coerce-to-block.rs
  168. +1 −1 src/test/run-pass/fn-pattern-expected-type.rs
  169. +1 −1 src/test/run-pass/foreach-nested.rs
  170. +1 −1 src/test/run-pass/foreach-put-structured.rs
  171. +1 −1 src/test/run-pass/foreach-simple-outer-slot.rs
  172. +1 −1 src/test/run-pass/issue-1458.rs
  173. +3 −3 src/test/run-pass/issue-2185.rs
  174. +1 −1 src/test/run-pass/issue-2487-a.rs
  175. +2 −2 src/test/run-pass/issue-2611.rs
  176. +1 −1 src/test/run-pass/issue-3874.rs
  177. +1 −1 src/test/run-pass/issue-868.rs
  178. +1 −1 src/test/run-pass/issue-912.rs
  179. +1 −1 src/test/run-pass/iter-range.rs
  180. +3 −3 src/test/run-pass/last-use-in-block.rs
  181. +4 −4 src/test/run-pass/monad.rs
  182. +1 −1 src/test/run-pass/mut-function-arguments.rs
  183. +1 −1 src/test/run-pass/newlambdas.rs
  184. +1 −1 src/test/run-pass/non-legacy-modes.rs
  185. +1 −1 src/test/run-pass/pipe-bank-proto.rs
  186. +1 −1 src/test/run-pass/purity-infer.rs
  187. +3 −3 src/test/run-pass/reflect-visit-data.rs
  188. +2 −2 src/test/run-pass/regions-fn-subtyping-2.rs
  189. +1 −1 src/test/run-pass/regions-infer-call-2.rs
  190. +1 −1 src/test/run-pass/regions-params.rs
  191. +1 −1 src/test/run-pass/ret-break-cont-in-block.rs
  192. +1 −1 src/test/run-pass/sendfn-is-a-block.rs
  193. +6 −6 src/test/run-pass/static-impl.rs
  194. +5 −5 src/test/run-pass/static-method-test.rs
  195. +1 −1 src/test/run-pass/task-killjoin-rsrc.rs
  196. +2 −2 src/test/run-pass/trait-generic.rs
  197. +1 −1 src/test/run-pass/type-params-in-for-each.rs
  198. +1 −1 src/test/run-pass/unnamed_argument_mode.rs
@@ -103,7 +103,7 @@ pub fn is_test_ignored(config: config, testfile: &Path) -> bool {
}
}
-fn iter_header(testfile: &Path, it: fn(~str) -> bool) -> bool {
+fn iter_header(testfile: &Path, it: &fn(~str) -> bool) -> bool {
let rdr = io::file_reader(testfile).get();
while !rdr.eof() {
let ln = rdr.read_line();
@@ -530,7 +530,7 @@ fn compose_and_run(config: config, testfile: &Path,
}
fn make_compile_args(config: config, props: TestProps, extras: ~[~str],
- xform: fn(config, (&Path)) -> Path,
+ xform: &fn(config, (&Path)) -> Path,
testfile: &Path) -> ProcArgs {
let prog = config.rustc_path;
let mut args = ~[testfile.to_str(),
View
@@ -61,7 +61,7 @@ pub pure fn capacity<T>(v: @[const T]) -> uint {
*/
#[inline(always)]
pub pure fn build_sized<A>(size: uint,
- builder: &fn(push: pure fn(v: A))) -> @[A] {
+ builder: &fn(push: &pure fn(v: A))) -> @[A] {
let mut vec: @[const A] = @[];
unsafe { raw::reserve(&mut vec, size); }
builder(|+x| unsafe { raw::push(&mut vec, x) });
@@ -79,7 +79,7 @@ pub pure fn build_sized<A>(size: uint,
* onto the vector being constructed.
*/
#[inline(always)]
-pub pure fn build<A>(builder: &fn(push: pure fn(v: A))) -> @[A] {
+pub pure fn build<A>(builder: &fn(push: &pure fn(v: A))) -> @[A] {
build_sized(4, builder)
}
@@ -97,7 +97,7 @@ pub pure fn build<A>(builder: &fn(push: pure fn(v: A))) -> @[A] {
*/
#[inline(always)]
pub pure fn build_sized_opt<A>(size: Option<uint>,
- builder: &fn(push: pure fn(v: A))) -> @[A] {
+ builder: &fn(push: &pure fn(v: A))) -> @[A] {
build_sized(size.get_or_default(4), builder)
}
View
@@ -67,7 +67,7 @@ pub pure fn to_str(v: bool) -> ~str { if v { ~"true" } else { ~"false" } }
* Iterates over all truth values by passing them to `blk` in an unspecified
* order
*/
-pub fn all_values(blk: fn(v: bool)) {
+pub fn all_values(blk: &fn(v: bool)) {
blk(true);
blk(false);
}
View
@@ -54,7 +54,7 @@ pub impl<T> Cell<T> {
}
// Calls a closure with a reference to the value.
- fn with_ref<R>(&self, op: fn(v: &T) -> R) -> R {
+ fn with_ref<R>(&self, op: &fn(v: &T) -> R) -> R {
let v = self.take();
let r = op(&v);
self.put_back(v);
View
@@ -124,7 +124,7 @@ struct AnnihilateStats {
n_bytes_freed: uint
}
-unsafe fn each_live_alloc(f: fn(box: *mut BoxRepr, uniq: bool) -> bool) {
+unsafe fn each_live_alloc(f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
use managed;
let task: *Task = transmute(rustrt::rust_get_task());
View
@@ -30,10 +30,10 @@ pub trait Map<K, V>: Mutable {
pure fn contains_key(&self, key: &K) -> bool;
/// Visit all keys
- pure fn each_key(&self, f: fn(&K) -> bool);
+ pure fn each_key(&self, f: &fn(&K) -> bool);
/// Visit all values
- pure fn each_value(&self, f: fn(&V) -> bool);
+ pure fn each_value(&self, f: &fn(&V) -> bool);
/// Return the value corresponding to the key in the map
pure fn find(&self, key: &K) -> Option<&self/V>;
@@ -71,14 +71,14 @@ pub trait Set<T>: Mutable {
pure fn is_superset(&self, other: &Self) -> bool;
/// Visit the values representing the difference
- pure fn difference(&self, other: &Self, f: fn(&T) -> bool);
+ pure fn difference(&self, other: &Self, f: &fn(&T) -> bool);
/// Visit the values representing the symmetric difference
- pure fn symmetric_difference(&self, other: &Self, f: fn(&T) -> bool);
+ pure fn symmetric_difference(&self, other: &Self, f: &fn(&T) -> bool);
/// Visit the values representing the intersection
- pure fn intersection(&self, other: &Self, f: fn(&T) -> bool);
+ pure fn intersection(&self, other: &Self, f: &fn(&T) -> bool);
/// Visit the values representing the union
- pure fn union(&self, other: &Self, f: fn(&T) -> bool);
+ pure fn union(&self, other: &Self, f: &fn(&T) -> bool);
}
View
@@ -399,7 +399,7 @@ pub impl<T> DList<T> {
}
/// Iterate over nodes.
- pure fn each_node(@mut self, f: fn(@mut DListNode<T>) -> bool) {
+ pure fn each_node(@mut self, f: &fn(@mut DListNode<T>) -> bool) {
let mut link = self.peek_n();
while link.is_some() {
let nobe = link.get();
View
@@ -24,8 +24,8 @@ pub enum Either<T, U> {
}
#[inline(always)]
-pub fn either<T, U, V>(f_left: fn(&T) -> V,
- f_right: fn(&U) -> V, value: &Either<T, U>) -> V {
+pub fn either<T, U, V>(f_left: &fn(&T) -> V,
+ f_right: &fn(&U) -> V, value: &Either<T, U>) -> V {
/*!
* Applies a function based on the given either value
*
@@ -148,7 +148,7 @@ pub pure fn unwrap_right<T,U>(eith: Either<T,U>) -> U {
pub impl<T, U> Either<T, U> {
#[inline(always)]
- fn either<V>(&self, f_left: fn(&T) -> V, f_right: fn(&U) -> V) -> V {
+ fn either<V>(&self, f_left: &fn(&T) -> V, f_right: &fn(&U) -> V) -> V {
either(f_left, f_right, self)
}
View
@@ -86,7 +86,7 @@ pub mod linear {
#[inline(always)]
pure fn bucket_sequence(&self, hash: uint,
- op: fn(uint) -> bool) -> uint {
+ op: &fn(uint) -> bool) -> uint {
let start_idx = self.to_bucket(hash);
let len_buckets = self.buckets.len();
let mut idx = start_idx;
@@ -263,7 +263,7 @@ pub mod linear {
}
fn search(&self, hash: uint,
- op: fn(x: &Option<Bucket<K, V>>) -> bool) {
+ op: &fn(x: &Option<Bucket<K, V>>) -> bool) {
let _ = self.bucket_sequence(hash, |i| op(&self.buckets[i]));
}
}
@@ -272,7 +272,7 @@ pub mod linear {
BaseIter<(&self/K, &self/V)> for LinearMap<K, V>
{
/// Visit all key-value pairs
- pure fn each(&self, blk: fn(&(&self/K, &self/V)) -> bool) {
+ pure fn each(&self, blk: &fn(&(&self/K, &self/V)) -> bool) {
for uint::range(0, self.buckets.len()) |i| {
let mut broke = false;
do self.buckets[i].map |bucket| {
@@ -315,12 +315,12 @@ pub mod linear {
}
/// Visit all keys
- pure fn each_key(&self, blk: fn(k: &K) -> bool) {
+ pure fn each_key(&self, blk: &fn(k: &K) -> bool) {
self.each(|&(k, _)| blk(k))
}
/// Visit all values
- pure fn each_value(&self, blk: fn(v: &V) -> bool) {
+ pure fn each_value(&self, blk: &fn(v: &V) -> bool) {
self.each(|&(_, v)| blk(v))
}
@@ -428,7 +428,7 @@ pub mod linear {
/// Return the value corresponding to the key in the map, or create,
/// insert, and return a new value if it doesn't exist.
- fn find_or_insert_with(&mut self, k: K, f: fn(&K) -> V) -> &self/V {
+ fn find_or_insert_with(&mut self, k: K, f: &fn(&K) -> V) -> &self/V {
if self.size >= self.resize_at {
// n.b.: We could also do this after searching, so
// that we do not resize if this call to insert is
@@ -457,7 +457,7 @@ pub mod linear {
}
}
- fn consume(&mut self, f: fn(K, V)) {
+ fn consume(&mut self, f: &fn(K, V)) {
let mut buckets = ~[];
self.buckets <-> buckets;
self.size = 0;
@@ -526,7 +526,7 @@ pub mod linear {
impl<T:Hash + IterBytes + Eq> BaseIter<T> for LinearSet<T> {
/// Visit all values in order
- pure fn each(&self, f: fn(&T) -> bool) { self.map.each_key(f) }
+ pure fn each(&self, f: &fn(&T) -> bool) { self.map.each_key(f) }
pure fn size_hint(&self) -> Option<uint> { Some(self.len()) }
}
@@ -583,7 +583,7 @@ pub mod linear {
}
/// Visit the values representing the difference
- pure fn difference(&self, other: &LinearSet<T>, f: fn(&T) -> bool) {
+ pure fn difference(&self, other: &LinearSet<T>, f: &fn(&T) -> bool) {
for self.each |v| {
if !other.contains(v) {
if !f(v) { return }
@@ -593,13 +593,13 @@ pub mod linear {
/// Visit the values representing the symmetric difference
pure fn symmetric_difference(&self, other: &LinearSet<T>,
- f: fn(&T) -> bool) {
+ f: &fn(&T) -> bool) {
self.difference(other, f);
other.difference(self, f);
}
/// Visit the values representing the intersection
- pure fn intersection(&self, other: &LinearSet<T>, f: fn(&T) -> bool) {
+ pure fn intersection(&self, other: &LinearSet<T>, f: &fn(&T) -> bool) {
for self.each |v| {
if other.contains(v) {
if !f(v) { return }
@@ -608,7 +608,7 @@ pub mod linear {
}
/// Visit the values representing the union
- pure fn union(&self, other: &LinearSet<T>, f: fn(&T) -> bool) {
+ pure fn union(&self, other: &LinearSet<T>, f: &fn(&T) -> bool) {
for self.each |v| {
if !f(v) { return }
}
View
@@ -118,13 +118,13 @@ pub trait ReaderUtil {
fn read_whole_stream(&self) -> ~[u8];
/// Iterate over every byte until the iterator breaks or EOF.
- fn each_byte(&self, it: fn(int) -> bool);
+ fn each_byte(&self, it: &fn(int) -> bool);
/// Iterate over every char until the iterator breaks or EOF.
- fn each_char(&self, it: fn(char) -> bool);
+ fn each_char(&self, it: &fn(char) -> bool);
/// Iterate over every line until the iterator breaks or EOF.
- fn each_line(&self, it: fn(&str) -> bool);
+ fn each_line(&self, it: &fn(&str) -> bool);
/// Read n (between 1 and 8) little-endian unsigned integer bytes.
fn read_le_uint_n(&self, nbytes: uint) -> u64;
@@ -315,19 +315,19 @@ impl<T:Reader> ReaderUtil for T {
bytes
}
- fn each_byte(&self, it: fn(int) -> bool) {
+ fn each_byte(&self, it: &fn(int) -> bool) {
while !self.eof() {
if !it(self.read_byte()) { break; }
}
}
- fn each_char(&self, it: fn(char) -> bool) {
+ fn each_char(&self, it: &fn(char) -> bool) {
while !self.eof() {
if !it(self.read_char()) { break; }
}
}
- fn each_line(&self, it: fn(s: &str) -> bool) {
+ fn each_line(&self, it: &fn(s: &str) -> bool) {
while !self.eof() {
if !it(self.read_line()) { break; }
}
@@ -618,11 +618,11 @@ impl Reader for BytesReader/&self {
fn tell(&self) -> uint { self.pos }
}
-pub pure fn with_bytes_reader<t>(bytes: &[u8], f: fn(@Reader) -> t) -> t {
+pub pure fn with_bytes_reader<t>(bytes: &[u8], f: &fn(@Reader) -> t) -> t {
f(@BytesReader { bytes: bytes, pos: 0u } as @Reader)
}
-pub pure fn with_str_reader<T>(s: &str, f: fn(@Reader) -> T) -> T {
+pub pure fn with_str_reader<T>(s: &str, f: &fn(@Reader) -> T) -> T {
str::byte_slice(s, |bytes| with_bytes_reader(bytes, f))
}
@@ -819,7 +819,7 @@ pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
}
pub fn u64_to_le_bytes<T>(n: u64, size: uint,
- f: fn(v: &[u8]) -> T) -> T {
+ f: &fn(v: &[u8]) -> T) -> T {
fail_unless!(size <= 8u);
match size {
1u => f(&[n as u8]),
@@ -851,7 +851,7 @@ pub fn u64_to_le_bytes<T>(n: u64, size: uint,
}
pub fn u64_to_be_bytes<T>(n: u64, size: uint,
- f: fn(v: &[u8]) -> T) -> T {
+ f: &fn(v: &[u8]) -> T) -> T {
fail_unless!(size <= 8u);
match size {
1u => f(&[n as u8]),
@@ -1142,14 +1142,14 @@ pub pure fn BytesWriter() -> BytesWriter {
BytesWriter { bytes: ~[], mut pos: 0u }
}
-pub pure fn with_bytes_writer(f: fn(Writer)) -> ~[u8] {
+pub pure fn with_bytes_writer(f: &fn(Writer)) -> ~[u8] {
let wr = @BytesWriter();
f(wr as Writer);
let @BytesWriter{bytes, _} = wr;
return bytes;
}
-pub pure fn with_str_writer(f: fn(Writer)) -> ~str {
+pub pure fn with_str_writer(f: &fn(Writer)) -> ~str {
let mut v = with_bytes_writer(f);
// FIXME (#3758): This should not be needed.
@@ -1251,7 +1251,7 @@ pub mod fsync {
// FIXME (#2004) find better way to create resources within lifetime of
// outer res
pub fn FILE_res_sync(file: &FILERes, opt_level: Option<Level>,
- blk: fn(v: Res<*libc::FILE>)) {
+ blk: &fn(v: Res<*libc::FILE>)) {
unsafe {
blk(Res(Arg {
val: file.f, opt_level: opt_level,
@@ -1266,7 +1266,7 @@ pub mod fsync {
// fsync fd after executing blk
pub fn fd_res_sync(fd: &FdRes, opt_level: Option<Level>,
- blk: fn(v: Res<fd_t>)) {
+ blk: &fn(v: Res<fd_t>)) {
blk(Res(Arg {
val: fd.fd, opt_level: opt_level,
fsync_fn: |fd, l| os::fsync_fd(fd, l) as int
@@ -1278,7 +1278,7 @@ pub mod fsync {
// Call o.fsync after executing blk
pub fn obj_sync(o: FSyncable, opt_level: Option<Level>,
- blk: fn(v: Res<FSyncable>)) {
+ blk: &fn(v: Res<FSyncable>)) {
blk(Res(Arg {
val: o, opt_level: opt_level,
fsync_fn: |o, l| o.fsync(l)
Oops, something went wrong.

0 comments on commit d18f785

Please sign in to comment.