Remove use of capture clause #4965

This commit is contained in:
Seth Pink 2013-02-17 08:54:34 +10:00
parent 945ac428b8
commit 1f4c758f9b
7 changed files with 8 additions and 9 deletions

View file

@ -76,7 +76,7 @@ fn apply_to_sections(
op: NominalOp<Op>, op: NominalOp<Op>,
sections: ~[doc::Section] sections: ~[doc::Section]
) -> ~[doc::Section] { ) -> ~[doc::Section] {
sections.map(|section, copy op| doc::Section { sections.map(|section| doc::Section {
header: (op.op)(copy section.header), header: (op.op)(copy section.header),
body: (op.op)(copy section.body) body: (op.op)(copy section.body)
}) })
@ -89,7 +89,7 @@ fn fold_enum(
let fold_copy = copy *fold; let fold_copy = copy *fold;
doc::EnumDoc { doc::EnumDoc {
variants: do doc.variants.map |variant, copy fold_copy| { variants: do doc.variants.map |variant| {
doc::VariantDoc { doc::VariantDoc {
desc: maybe_apply_op(copy fold_copy.ctxt, &variant.desc), desc: maybe_apply_op(copy fold_copy.ctxt, &variant.desc),
.. copy *variant .. copy *variant

View file

@ -137,7 +137,7 @@ fn fold_enum(
variants: do vec::map(doc.variants) |variant| { variants: do vec::map(doc.variants) |variant| {
let sig = { let sig = {
let variant = copy *variant; let variant = copy *variant;
do astsrv::exec(srv.clone()) |copy variant, ctxt| { do astsrv::exec(srv.clone()) |ctxt| {
match ctxt.ast_map.get(&doc_id) { match ctxt.ast_map.get(&doc_id) {
ast_map::node_item(@ast::item { ast_map::node_item(@ast::item {
node: ast::item_enum(ref enum_definition, _), _ node: ast::item_enum(ref enum_definition, _), _
@ -198,7 +198,7 @@ fn get_method_sig(
item_id: doc::AstId, item_id: doc::AstId,
method_name: ~str method_name: ~str
) -> Option<~str> { ) -> Option<~str> {
do astsrv::exec(srv) |copy method_name, ctxt| { do astsrv::exec(srv) |ctxt| {
match ctxt.ast_map.get(&item_id) { match ctxt.ast_map.get(&item_id) {
ast_map::node_item(@ast::item { ast_map::node_item(@ast::item {
node: ast::item_trait(_, _, ref methods), _ node: ast::item_trait(_, _, ref methods), _

View file

@ -368,7 +368,7 @@ fn run_line(repl: &mut Repl, in: io::Reader, out: io::Writer, line: ~str)
} }
let r = *repl; let r = *repl;
let result = do task::try |copy r| { let result = do task::try {
run(r, line) run(r, line)
}; };

View file

@ -202,7 +202,7 @@ pub mod test {
#[test] #[test]
pub fn test_sendable_future() { pub fn test_sendable_future() {
let expected = ~"schlorf"; let expected = ~"schlorf";
let f = do spawn |copy expected| { copy expected }; let f = do spawn { copy expected };
do task::spawn || { do task::spawn || {
let actual = f.get(); let actual = f.get();
assert actual == expected; assert actual == expected;

View file

@ -12,7 +12,7 @@ use core::pipes::*;
pub fn foo<T: Owned Copy>(x: T) -> Port<T> { pub fn foo<T: Owned Copy>(x: T) -> Port<T> {
let (p, c) = stream(); let (p, c) = stream();
do task::spawn() |copy x| { do task::spawn() {
c.send(x); c.send(x);
} }
p p

View file

@ -28,7 +28,7 @@ use core::pipes::*;
fn foo(&&x: ()) -> Port<()> { fn foo(&&x: ()) -> Port<()> {
let (p, c) = stream::<()>(); let (p, c) = stream::<()>();
do task::spawn() |copy x| { do task::spawn() {
c.send(x); c.send(x);
} }
p p

View file

@ -12,7 +12,6 @@ enum Msg
fn foo(name: ~str, samples_chan: Chan<Msg>) { fn foo(name: ~str, samples_chan: Chan<Msg>) {
do task::spawn do task::spawn
|copy name|
{ {
let callback: SamplesFn = let callback: SamplesFn =
|buffer| |buffer|