Skip to content

Commit d2bcc7b

Browse files
committed
Improve variable naming.
1 parent 74d2731 commit d2bcc7b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/test/bench/shootout-meteor.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,21 @@ impl<'self, T> Iterator<&'self T> for ListIterator<'self, T> {
6363
// corresponding mirrored piece), with, as minimum coordinates, (0,
6464
// 0). If all is false, only generate half of the possibilities (used
6565
// to break the symetry of the board).
66-
fn transform(p: ~[(int, int)], all: bool) -> ~[~[(int, int)]] {
66+
fn transform(piece: ~[(int, int)], all: bool) -> ~[~[(int, int)]] {
6767
let mut res =
6868
// rotations
69-
iterate(p, |p| p.iter().map(|&(y, x)| (x + y, -y)).collect())
69+
iterate(piece, |rot| rot.iter().map(|&(y, x)| (x + y, -y)).collect())
7070
.take(if all {6} else {3})
7171
// mirror
72-
.flat_map(|p| {
73-
iterate(p, |p| p.iter().map(|&(y, x)| (x, y)).collect()).take(2)
72+
.flat_map(|cur_piece| {
73+
iterate(cur_piece, |mir| mir.iter().map(|&(y, x)| (x, y)).collect())
74+
.take(2)
7475
}).to_owned_vec();
7576

7677
// translating to (0, 0) as minimum coordinates.
77-
for p in res.mut_iter() {
78-
let (dy, dx) = *p.iter().min_by(|e| *e).unwrap();
79-
for &(ref mut y, ref mut x) in p.mut_iter() {
78+
for cur_piece in res.mut_iter() {
79+
let (dy, dx) = *cur_piece.iter().min_by(|e| *e).unwrap();
80+
for &(ref mut y, ref mut x) in cur_piece.mut_iter() {
8081
*y -= dy; *x -= dx;
8182
}
8283
}

0 commit comments

Comments
 (0)