Skip to content

Commit 09a32ae

Browse files
committed
Remove warnings in std::par.
1 parent 58fdbdc commit 09a32ae

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/libstd/par.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn map_slices<A: copy send, B: copy send>(
7575
#[doc="A parallel version of map."]
7676
fn map<A: copy send, B: copy send>(xs: [A], f: fn~(A) -> B) -> [B] {
7777
vec::concat(map_slices(xs) {||
78-
fn~(_base: uint, slice : [const A]/&) -> [B] {
78+
fn~(_base: uint, slice : [const A]/&, copy f) -> [B] {
7979
vec::map(slice, f)
8080
}
8181
})
@@ -84,7 +84,7 @@ fn map<A: copy send, B: copy send>(xs: [A], f: fn~(A) -> B) -> [B] {
8484
#[doc="A parallel version of mapi."]
8585
fn mapi<A: copy send, B: copy send>(xs: [A], f: fn~(uint, A) -> B) -> [B] {
8686
let slices = map_slices(xs) {||
87-
fn~(base: uint, slice : [const A]/&) -> [B] {
87+
fn~(base: uint, slice : [const A]/&, copy f) -> [B] {
8888
vec::mapi(slice) {|i, x|
8989
f(i + base, x)
9090
}
@@ -104,7 +104,7 @@ fn mapi_factory<A: copy send, B: copy send>(
104104
xs: [A], f: fn() -> fn~(uint, A) -> B) -> [B] {
105105
let slices = map_slices(xs) {||
106106
let f = f();
107-
fn~(base: uint, slice : [const A]/&) -> [B] {
107+
fn~(base: uint, slice : [const A]/&, move f) -> [B] {
108108
vec::mapi(slice) {|i, x|
109109
f(i + base, x)
110110
}
@@ -118,16 +118,20 @@ fn mapi_factory<A: copy send, B: copy send>(
118118

119119
#[doc="Returns true if the function holds for all elements in the vector."]
120120
fn alli<A: copy send>(xs: [A], f: fn~(uint, A) -> bool) -> bool {
121-
vec::all(map_slices(xs) {|| fn~(base: uint, slice : [const A]/&) -> bool {
122-
vec::alli(slice) {|i, x|
123-
f(i + base, x)
121+
vec::all(map_slices(xs) {||
122+
fn~(base: uint, slice : [const A]/&, copy f) -> bool {
123+
vec::alli(slice) {|i, x|
124+
f(i + base, x)
125+
}
124126
}
125-
}}) {|x| x }
127+
}) {|x| x }
126128
}
127129

128130
#[doc="Returns true if the function holds for any elements in the vector."]
129131
fn any<A: copy send>(xs: [A], f: fn~(A) -> bool) -> bool {
130-
vec::any(map_slices(xs) {|| fn~(_base : uint, slice: [const A]/&) -> bool {
131-
vec::any(slice, f)
132-
}}) {|x| x }
132+
vec::any(map_slices(xs) {||
133+
fn~(_base : uint, slice: [const A]/&, copy f) -> bool {
134+
vec::any(slice, f)
135+
}
136+
}) {|x| x }
133137
}

src/test/bench/graph500-bfs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ fn main(args: [str]) {
384384
let scale = uint::from_str(args[1]).get();
385385
let num_keys = uint::from_str(args[2]).get();
386386
let do_validate = false;
387-
let do_sequential = false;
387+
let do_sequential = true;
388388

389389
let start = time::precise_time_s();
390390
let edges = make_edges(scale, 16u);

0 commit comments

Comments
 (0)