Skip to content

Commit e1f89fe

Browse files
committed
---
yaml --- r: 146862 b: refs/heads/try2 c: 1eca34d h: refs/heads/master v: v3
1 parent 8fc4fda commit e1f89fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+723
-896
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 6801bc8f552ce740deb60212903ba43de197689c
8+
refs/heads/try2: 1eca34de7dd55719cd83153994e5caf2027f62a2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/ascii.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl<'self> AsciiStr for &'self [Ascii] {
290290

291291
#[inline]
292292
fn eq_ignore_case(self, other: &[Ascii]) -> bool {
293-
do self.iter().zip(other.iter()).all |(&a, &b)| { a.eq_ignore_case(b) }
293+
self.iter().zip(other.iter()).all(|(&a, &b)| a.eq_ignore_case(b))
294294
}
295295
}
296296

branches/try2/src/libstd/at_vec.rs

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,24 @@ pub fn build<A>(size: Option<uint>, builder: |push: |v: A||) -> @[A] {
5656
/// `lhs`. Afterwards, the `lhs` is then returned for use again.
5757
#[inline]
5858
pub fn append<T:Clone>(lhs: @[T], rhs: &[T]) -> @[T] {
59-
do build(Some(lhs.len() + rhs.len())) |push| {
59+
build(Some(lhs.len() + rhs.len()), |push| {
6060
for x in lhs.iter() {
6161
push((*x).clone());
6262
}
6363
for elt in rhs.iter() {
6464
push(elt.clone());
6565
}
66-
}
66+
})
6767
}
6868

6969

7070
/// Apply a function to each element of a vector and return the results
7171
pub fn map<T, U>(v: &[T], f: |x: &T| -> U) -> @[U] {
72-
do build(Some(v.len())) |push| {
72+
build(Some(v.len()), |push| {
7373
for elem in v.iter() {
7474
push(f(elem));
7575
}
76-
}
76+
})
7777
}
7878

7979
/**
@@ -83,10 +83,10 @@ pub fn map<T, U>(v: &[T], f: |x: &T| -> U) -> @[U] {
8383
* to the value returned by the function `op`.
8484
*/
8585
pub fn from_fn<T>(n_elts: uint, op: |uint| -> T) -> @[T] {
86-
do build(Some(n_elts)) |push| {
86+
build(Some(n_elts), |push| {
8787
let mut i: uint = 0u;
8888
while i < n_elts { push(op(i)); i += 1u; }
89-
}
89+
})
9090
}
9191

9292
/**
@@ -96,13 +96,13 @@ pub fn from_fn<T>(n_elts: uint, op: |uint| -> T) -> @[T] {
9696
* to the value `t`.
9797
*/
9898
pub fn from_elem<T:Clone>(n_elts: uint, t: T) -> @[T] {
99-
do build(Some(n_elts)) |push| {
99+
build(Some(n_elts), |push| {
100100
let mut i: uint = 0u;
101101
while i < n_elts {
102102
push(t.clone());
103103
i += 1u;
104104
}
105-
}
105+
})
106106
}
107107

108108
/**
@@ -137,11 +137,11 @@ impl<T> Clone for @[T] {
137137
impl<A> FromIterator<A> for @[A] {
138138
fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> @[A] {
139139
let (lower, _) = iterator.size_hint();
140-
do build(Some(lower)) |push| {
140+
build(Some(lower), |push| {
141141
for x in *iterator {
142142
push(x);
143143
}
144-
}
144+
})
145145
}
146146
}
147147

@@ -259,9 +259,9 @@ pub mod raw {
259259
use rt::local::Local;
260260
use rt::task::Task;
261261

262-
do Local::borrow |task: &mut Task| {
262+
Local::borrow(|task: &mut Task| {
263263
task.heap.realloc(ptr as *mut Box<()>, size) as *()
264-
}
264+
})
265265
}
266266
}
267267

@@ -295,11 +295,11 @@ mod test {
295295
fn test() {
296296
// Some code that could use that, then:
297297
fn seq_range(lo: uint, hi: uint) -> @[uint] {
298-
do build(None) |push| {
298+
build(None, |push| {
299299
for i in range(lo, hi) {
300300
push(i);
301301
}
302-
}
302+
})
303303
}
304304

305305
assert_eq!(seq_range(10, 15), @[10, 11, 12, 13, 14]);
@@ -333,9 +333,7 @@ mod test {
333333
#[bench]
334334
fn bench_capacity(b: &mut bh) {
335335
let x = @[1, 2, 3];
336-
do b.iter {
337-
capacity(x);
338-
}
336+
b.iter(|| capacity(x));
339337
}
340338

341339
#[bench]
@@ -359,54 +357,42 @@ mod test {
359357
fn bench_append(b: &mut bh) {
360358
let lhs = @[7, ..128];
361359
let rhs = range(0, 256).to_owned_vec();
362-
do b.iter {
363-
append(lhs, rhs);
364-
}
360+
b.iter(|| append(lhs, rhs))
365361
}
366362

367363
#[bench]
368364
fn bench_map(b: &mut bh) {
369365
let elts = range(0, 256).to_owned_vec();
370-
do b.iter {
371-
map(elts, |x| x*2);
372-
}
366+
b.iter(|| map(elts, |x| x*2))
373367
}
374368

375369
#[bench]
376370
fn bench_from_fn(b: &mut bh) {
377-
do b.iter {
378-
from_fn(1024, |x| x);
379-
}
371+
b.iter(|| from_fn(1024, |x| x));
380372
}
381373

382374
#[bench]
383375
fn bench_from_elem(b: &mut bh) {
384-
do b.iter {
385-
from_elem(1024, 0u64);
386-
}
376+
b.iter(|| from_elem(1024, 0u64));
387377
}
388378

389379
#[bench]
390380
fn bench_to_managed_move(b: &mut bh) {
391-
do b.iter {
381+
b.iter(|| {
392382
let elts = range(0, 1024).to_owned_vec(); // yikes! can't move out of capture, though
393383
to_managed_move(elts);
394-
}
384+
})
395385
}
396386

397387
#[bench]
398388
fn bench_to_managed(b: &mut bh) {
399389
let elts = range(0, 1024).to_owned_vec();
400-
do b.iter {
401-
to_managed(elts);
402-
}
390+
b.iter(|| to_managed(elts));
403391
}
404392

405393
#[bench]
406394
fn bench_clone(b: &mut bh) {
407395
let elts = to_managed(range(0, 1024).to_owned_vec());
408-
do b.iter {
409-
elts.clone();
410-
}
396+
b.iter(|| elts.clone());
411397
}
412398
}

0 commit comments

Comments
 (0)