Skip to content

Commit aa8af12

Browse files
committed
auto merge of #4995 : sethpink/rust/obsolete-capture-clause, r=graydon
Remove capture clause use. I think I got them all.
2 parents 945ac42 + 60bd4a5 commit aa8af12

File tree

10 files changed

+13
-14
lines changed

10 files changed

+13
-14
lines changed

src/librustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ fn encode_side_tables_for_ii(ecx: @e::encode_ctxt,
821821
let ebml_w = copy ebml_w;
822822
ast_util::visit_ids_for_inlined_item(
823823
ii,
824-
fn@(id: ast::node_id, copy ebml_w) {
824+
fn@(id: ast::node_id) {
825825
// Note: this will cause a copy of ebml_w, which is bad as
826826
// it has mut fields. But I believe it's harmless since
827827
// we generate balanced EBML.

src/librustdoc/text_pass.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn apply_to_sections(
7676
op: NominalOp<Op>,
7777
sections: ~[doc::Section]
7878
) -> ~[doc::Section] {
79-
sections.map(|section, copy op| doc::Section {
79+
sections.map(|section| doc::Section {
8080
header: (op.op)(copy section.header),
8181
body: (op.op)(copy section.body)
8282
})
@@ -89,7 +89,7 @@ fn fold_enum(
8989
let fold_copy = copy *fold;
9090

9191
doc::EnumDoc {
92-
variants: do doc.variants.map |variant, copy fold_copy| {
92+
variants: do doc.variants.map |variant| {
9393
doc::VariantDoc {
9494
desc: maybe_apply_op(copy fold_copy.ctxt, &variant.desc),
9595
.. copy *variant

src/librustdoc/tystr_pass.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn fold_enum(
137137
variants: do vec::map(doc.variants) |variant| {
138138
let sig = {
139139
let variant = copy *variant;
140-
do astsrv::exec(srv.clone()) |copy variant, ctxt| {
140+
do astsrv::exec(srv.clone()) |ctxt| {
141141
match ctxt.ast_map.get(&doc_id) {
142142
ast_map::node_item(@ast::item {
143143
node: ast::item_enum(ref enum_definition, _), _
@@ -198,7 +198,7 @@ fn get_method_sig(
198198
item_id: doc::AstId,
199199
method_name: ~str
200200
) -> Option<~str> {
201-
do astsrv::exec(srv) |copy method_name, ctxt| {
201+
do astsrv::exec(srv) |ctxt| {
202202
match ctxt.ast_map.get(&item_id) {
203203
ast_map::node_item(@ast::item {
204204
node: ast::item_trait(_, _, ref methods), _

src/librusti/rusti.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ fn run_line(repl: &mut Repl, in: io::Reader, out: io::Writer, line: ~str)
368368
}
369369

370370
let r = *repl;
371-
let result = do task::try |copy r| {
371+
let result = do task::try {
372372
run(r, line)
373373
};
374374

src/libstd/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub mod test {
202202
#[test]
203203
pub fn test_sendable_future() {
204204
let expected = ~"schlorf";
205-
let f = do spawn |copy expected| { copy expected };
205+
let f = do spawn { copy expected };
206206
do task::spawn || {
207207
let actual = f.get();
208208
assert actual == expected;

src/libstd/par.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn mapi<A: Copy Owned, B: Copy Owned>(
107107
{
108108
let slices = map_slices(xs, || {
109109
let f = fn_factory();
110-
fn~(base: uint, slice : &[A], copy f) -> ~[B] {
110+
fn~(base: uint, slice : &[A]) -> ~[B] {
111111
vec::mapi(slice, |i, x| {
112112
f(i + base, x)
113113
})
@@ -126,7 +126,7 @@ pub fn alli<A: Copy Owned>(
126126
{
127127
do vec::all(map_slices(xs, || {
128128
let f = fn_factory();
129-
fn~(base: uint, slice : &[A], copy f) -> bool {
129+
fn~(base: uint, slice : &[A]) -> bool {
130130
vec::alli(slice, |i, x| {
131131
f(i + base, x)
132132
})
@@ -140,7 +140,7 @@ pub fn any<A: Copy Owned>(
140140
fn_factory: &fn() -> ~fn(&A) -> bool) -> bool {
141141
do vec::any(map_slices(xs, || {
142142
let f = fn_factory();
143-
fn~(_base : uint, slice: &[A], copy f) -> bool {
143+
fn~(_base : uint, slice: &[A]) -> bool {
144144
vec::any(slice, |x| f(x))
145145
}
146146
})) |x| { *x }

src/test/auxiliary/cci_capture_clause.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use core::pipes::*;
1212

1313
pub fn foo<T: Owned Copy>(x: T) -> Port<T> {
1414
let (p, c) = stream();
15-
do task::spawn() |copy x| {
15+
do task::spawn() {
1616
c.send(x);
1717
}
1818
p

src/test/compile-fail/kindck-nonsendable-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ fn foo(_x: @uint) {}
1313
fn main() {
1414
let x = @3u;
1515
let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
16-
let _ = fn~(copy x) { foo(x); }; //~ ERROR value has non-owned type `@uint`
16+
let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
1717
let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
1818
}

src/test/run-pass/capture_nil.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use core::pipes::*;
2828

2929
fn foo(&&x: ()) -> Port<()> {
3030
let (p, c) = stream::<()>();
31-
do task::spawn() |copy x| {
31+
do task::spawn() {
3232
c.send(x);
3333
}
3434
p

src/test/run-pass/issue-3609.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ enum Msg
1212

1313
fn foo(name: ~str, samples_chan: Chan<Msg>) {
1414
do task::spawn
15-
|copy name|
1615
{
1716
let callback: SamplesFn =
1817
|buffer|

0 commit comments

Comments
 (0)