diff options
| author | Guillaume Pinot <texitoi@texitoi.eu> | 2013-11-14 23:22:44 +0100 |
|---|---|---|
| committer | Guillaume Pinot <texitoi@texitoi.eu> | 2013-11-14 23:22:44 +0100 |
| commit | d2bcc7b621b791f4abe7000a99816209a8ea7a45 (patch) | |
| tree | 8e77dfe7ab2fb43eb653c8cc8b292df4a9d51472 | |
| parent | 74d27311a7ecb50b4783b6adc4a977a6e51759b2 (diff) | |
| download | rust-d2bcc7b621b791f4abe7000a99816209a8ea7a45.tar.gz rust-d2bcc7b621b791f4abe7000a99816209a8ea7a45.zip | |
Improve variable naming.
| -rw-r--r-- | src/test/bench/shootout-meteor.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 2c72e8f30f2..78b31b335c9 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -63,20 +63,21 @@ impl<'self, T> Iterator<&'self T> for ListIterator<'self, T> { // corresponding mirrored piece), with, as minimum coordinates, (0, // 0). If all is false, only generate half of the possibilities (used // to break the symetry of the board). -fn transform(p: ~[(int, int)], all: bool) -> ~[~[(int, int)]] { +fn transform(piece: ~[(int, int)], all: bool) -> ~[~[(int, int)]] { let mut res = // rotations - iterate(p, |p| p.iter().map(|&(y, x)| (x + y, -y)).collect()) + iterate(piece, |rot| rot.iter().map(|&(y, x)| (x + y, -y)).collect()) .take(if all {6} else {3}) // mirror - .flat_map(|p| { - iterate(p, |p| p.iter().map(|&(y, x)| (x, y)).collect()).take(2) + .flat_map(|cur_piece| { + iterate(cur_piece, |mir| mir.iter().map(|&(y, x)| (x, y)).collect()) + .take(2) }).to_owned_vec(); // translating to (0, 0) as minimum coordinates. - for p in res.mut_iter() { - let (dy, dx) = *p.iter().min_by(|e| *e).unwrap(); - for &(ref mut y, ref mut x) in p.mut_iter() { + for cur_piece in res.mut_iter() { + let (dy, dx) = *cur_piece.iter().min_by(|e| *e).unwrap(); + for &(ref mut y, ref mut x) in cur_piece.mut_iter() { *y -= dy; *x -= dx; } } |
