diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-03-07 14:38:38 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-03-11 09:35:58 -0700 |
| commit | d18f7854578e8c2e1d7dce90db6e3b5cf9befba9 (patch) | |
| tree | 518a4098922b97624778cff41bbdc86547e43afe /src/libsyntax | |
| parent | 51cdca0bf0d3efc554c1815df9306ea10e881a14 (diff) | |
| download | rust-d18f7854578e8c2e1d7dce90db6e3b5cf9befba9.tar.gz rust-d18f7854578e8c2e1d7dce90db6e3b5cf9befba9.zip | |
librustc: Replace all uses of `fn()` with `&fn()`. rs=defun
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_encode.rs | 32 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/opt_vec.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/parse/common.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 4 |
10 files changed, 42 insertions, 42 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 3001fe8069c..a7d5c0ce75f 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -423,7 +423,7 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str { } pub fn node_item_query<Result>(items: map, id: node_id, - query: fn(@item) -> Result, + query: &fn(@item) -> Result, +error_msg: ~str) -> Result { match items.find(&id) { Some(node_item(it, _)) => query(it), diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 7b0e72e6e95..35b188a248f 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -516,7 +516,7 @@ pub pure fn is_item_impl(item: @ast::item) -> bool { } } -pub fn walk_pat(pat: @pat, it: fn(@pat)) { +pub fn walk_pat(pat: @pat, it: &fn(@pat)) { it(pat); match pat.node { pat_ident(_, _, Some(p)) => walk_pat(p, it), diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 33e734fbd64..4e177fecec9 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -306,7 +306,7 @@ fn print_macro_backtrace(cm: @codemap::CodeMap, sp: span) { pub fn expect<T:Copy>(diag: span_handler, opt: Option<T>, - msg: fn() -> ~str) -> T { + msg: &fn() -> ~str) -> T { match opt { Some(ref t) => (*t), None => diag.handler().bug(msg()) diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index ecb5be6cc3c..8aa03e14fa4 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -432,7 +432,7 @@ fn mk_impl( ty_param: ast::TyParam, path: @ast::path, generics: &ast::Generics, - f: fn(@ast::Ty) -> @ast::method + f: &fn(@ast::Ty) -> @ast::method ) -> @ast::item { /*! * @@ -1256,51 +1256,51 @@ mod test { fn emit_owned_str(&self, +_v: &str) { self.add_unknown_to_log(); } fn emit_managed_str(&self, +_v: &str) { self.add_unknown_to_log(); } - fn emit_borrowed(&self, f: fn()) { self.add_unknown_to_log(); f() } - fn emit_owned(&self, f: fn()) { self.add_unknown_to_log(); f() } - fn emit_managed(&self, f: fn()) { self.add_unknown_to_log(); f() } + fn emit_borrowed(&self, f: &fn()) { self.add_unknown_to_log(); f() } + fn emit_owned(&self, f: &fn()) { self.add_unknown_to_log(); f() } + fn emit_managed(&self, f: &fn()) { self.add_unknown_to_log(); f() } - fn emit_enum(&self, name: &str, f: fn()) { + fn emit_enum(&self, name: &str, f: &fn()) { self.add_to_log(CallToEmitEnum(name.to_str())); f(); } fn emit_enum_variant(&self, name: &str, +id: uint, - +cnt: uint, f: fn()) { + +cnt: uint, f: &fn()) { self.add_to_log(CallToEmitEnumVariant (name.to_str(),id,cnt)); f(); } - fn emit_enum_variant_arg(&self, +idx: uint, f: fn()) { + fn emit_enum_variant_arg(&self, +idx: uint, f: &fn()) { self.add_to_log(CallToEmitEnumVariantArg (idx)); f(); } - fn emit_borrowed_vec(&self, +_len: uint, f: fn()) { + fn emit_borrowed_vec(&self, +_len: uint, f: &fn()) { self.add_unknown_to_log(); f(); } - fn emit_owned_vec(&self, +_len: uint, f: fn()) { + fn emit_owned_vec(&self, +_len: uint, f: &fn()) { self.add_unknown_to_log(); f(); } - fn emit_managed_vec(&self, +_len: uint, f: fn()) { + fn emit_managed_vec(&self, +_len: uint, f: &fn()) { self.add_unknown_to_log(); f(); } - fn emit_vec_elt(&self, +_idx: uint, f: fn()) { + fn emit_vec_elt(&self, +_idx: uint, f: &fn()) { self.add_unknown_to_log(); f(); } - fn emit_rec(&self, f: fn()) { + fn emit_rec(&self, f: &fn()) { self.add_unknown_to_log(); f(); } - fn emit_struct(&self, name: &str, +len: uint, f: fn()) { + fn emit_struct(&self, name: &str, +len: uint, f: &fn()) { self.add_to_log(CallToEmitStruct (name.to_str(),len)); f(); } - fn emit_field(&self, name: &str, +idx: uint, f: fn()) { + fn emit_field(&self, name: &str, +idx: uint, f: &fn()) { self.add_to_log(CallToEmitField (name.to_str(),idx)); f(); } - fn emit_tup(&self, +_len: uint, f: fn()) { + fn emit_tup(&self, +_len: uint, f: &fn()) { self.add_unknown_to_log(); f(); } - fn emit_tup_elt(&self, +_idx: uint, f: fn()) { + fn emit_tup_elt(&self, +_idx: uint, f: &fn()) { self.add_unknown_to_log(); f(); } } diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 329b3f59b1e..dc9abd536d1 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -104,7 +104,7 @@ pub impl state_ { /// Iterate over the states that can be reached in one message /// from this state. - fn reachable(&self, f: fn(state) -> bool) { + fn reachable(&self, f: &fn(state) -> bool) { for self.messages.each |m| { match *m { message(_, _, _, _, Some(next_state { state: ref id, _ })) => { diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 16db384bb06..ba0c7a71b7c 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -122,7 +122,7 @@ impl<A:Eq> Eq for OptVec<A> { } impl<A> BaseIter<A> for OptVec<A> { - pure fn each(&self, blk: fn(v: &A) -> bool) { + pure fn each(&self, blk: &fn(v: &A) -> bool) { match *self { Empty => {} Vec(ref v) => v.each(blk) @@ -136,31 +136,31 @@ impl<A> BaseIter<A> for OptVec<A> { impl<A> iter::ExtendedIter<A> for OptVec<A> { #[inline(always)] - pure fn eachi(&self, blk: fn(+v: uint, v: &A) -> bool) { + pure fn eachi(&self, blk: &fn(+v: uint, v: &A) -> bool) { iter::eachi(self, blk) } #[inline(always)] - pure fn all(&self, blk: fn(&A) -> bool) -> bool { + pure fn all(&self, blk: &fn(&A) -> bool) -> bool { iter::all(self, blk) } #[inline(always)] - pure fn any(&self, blk: fn(&A) -> bool) -> bool { + pure fn any(&self, blk: &fn(&A) -> bool) -> bool { iter::any(self, blk) } #[inline(always)] - pure fn foldl<B>(&self, +b0: B, blk: fn(&B, &A) -> B) -> B { + pure fn foldl<B>(&self, +b0: B, blk: &fn(&B, &A) -> B) -> B { iter::foldl(self, b0, blk) } #[inline(always)] - pure fn position(&self, f: fn(&A) -> bool) -> Option<uint> { + pure fn position(&self, f: &fn(&A) -> bool) -> Option<uint> { iter::position(self, f) } #[inline(always)] - pure fn map_to_vec<B>(&self, op: fn(&A) -> B) -> ~[B] { + pure fn map_to_vec<B>(&self, op: &fn(&A) -> B) -> ~[B] { iter::map_to_vec(self, op) } #[inline(always)] - pure fn flat_map_to_vec<B,IB:BaseIter<B>>(&self, op: fn(&A) -> IB) + pure fn flat_map_to_vec<B,IB:BaseIter<B>>(&self, op: &fn(&A) -> IB) -> ~[B] { iter::flat_map_to_vec(self, op) } @@ -176,13 +176,13 @@ impl<A: Eq> iter::EqIter<A> for OptVec<A> { impl<A: Copy> iter::CopyableIter<A> for OptVec<A> { #[inline(always)] - pure fn filter_to_vec(&self, pred: fn(&A) -> bool) -> ~[A] { + pure fn filter_to_vec(&self, pred: &fn(&A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } #[inline(always)] pure fn to_vec(&self) -> ~[A] { iter::to_vec(self) } #[inline(always)] - pure fn find(&self, f: fn(&A) -> bool) -> Option<A> { + pure fn find(&self, f: &fn(&A) -> bool) -> Option<A> { iter::find(self, f) } } diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 7af2204fafd..c7b9a769293 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -248,7 +248,7 @@ pub impl Parser { fn parse_seq_to_before_gt<T: Copy>( &self, sep: Option<token::Token>, - f: fn(&Parser) -> T + f: &fn(&Parser) -> T ) -> OptVec<T> { let mut first = true; let mut v = opt_vec::Empty; @@ -269,7 +269,7 @@ pub impl Parser { fn parse_seq_to_gt<T: Copy>( &self, sep: Option<token::Token>, - f: fn(&Parser) -> T + f: &fn(&Parser) -> T ) -> OptVec<T> { let v = self.parse_seq_to_before_gt(sep, f); self.expect_gt(); @@ -283,7 +283,7 @@ pub impl Parser { &self, ket: &token::Token, sep: SeqSep, - f: fn(&Parser) -> T + f: &fn(&Parser) -> T ) -> ~[T] { let val = self.parse_seq_to_before_end(ket, sep, f); self.bump(); @@ -297,7 +297,7 @@ pub impl Parser { &self, ket: &token::Token, sep: SeqSep, - f: fn(&Parser) -> T + f: &fn(&Parser) -> T ) -> ~[T] { let mut first: bool = true; let mut v: ~[T] = ~[]; @@ -323,7 +323,7 @@ pub impl Parser { bra: &token::Token, ket: &token::Token, sep: SeqSep, - f: fn(&Parser) -> T + f: &fn(&Parser) -> T ) -> ~[T] { self.expect(bra); let result = self.parse_seq_to_before_end(ket, sep, f); @@ -338,7 +338,7 @@ pub impl Parser { bra: &token::Token, ket: &token::Token, sep: SeqSep, - f: fn(&Parser) -> T + f: &fn(&Parser) -> T ) -> spanned<~[T]> { let lo = self.span.lo; self.expect(bra); diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index a1fc7230dd1..fd84f867068 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -173,7 +173,7 @@ pub fn parse_tts_from_source_str( } pub fn parse_from_source_str<T>( - f: fn (Parser) -> T, + f: &fn (Parser) -> T, name: ~str, ss: codemap::FileSubstr, source: @~str, +cfg: ast::crate_cfg, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 38cd09abad4..92ff83a3975 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1829,7 +1829,7 @@ pub impl Parser { fn parse_sugary_call_expr(&self, keyword: ~str, sugar: CallSugar, - ctor: fn(+v: @expr) -> expr_) -> @expr { + ctor: &fn(+v: @expr) -> expr_) -> @expr { let lo = self.last_span; // Parse the callee `foo` in // for foo || { @@ -2769,7 +2769,7 @@ pub impl Parser { (lifetimes, opt_vec::take_vec(result)) } - fn parse_fn_decl(&self, parse_arg_fn: fn(&Parser) -> arg_or_capture_item) + fn parse_fn_decl(&self, parse_arg_fn: &fn(&Parser) -> arg_or_capture_item) -> fn_decl { let args_or_capture_items: ~[arg_or_capture_item] = @@ -2816,7 +2816,7 @@ pub impl Parser { fn(&Parser) -> arg_or_capture_item ) -> (self_ty, fn_decl) { fn maybe_parse_self_ty( - cnstr: fn(+v: mutability) -> ast::self_ty_, + cnstr: &fn(+v: mutability) -> ast::self_ty_, p: &Parser ) -> ast::self_ty_ { // We need to make sure it isn't a mode or a type diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index c81c1c8bd0e..e7e2435587e 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -314,8 +314,8 @@ pub fn commasep<IN>(s: @ps, b: breaks, elts: ~[IN], op: &fn(@ps, IN)) { } -pub fn commasep_cmnt<IN>(s: @ps, b: breaks, elts: ~[IN], op: fn(@ps, IN), - get_span: fn(IN) -> codemap::span) { +pub fn commasep_cmnt<IN>(s: @ps, b: breaks, elts: ~[IN], op: &fn(@ps, IN), + get_span: &fn(IN) -> codemap::span) { box(s, 0u, b); let len = vec::len::<IN>(elts); let mut i = 0u; |
