Skip to content

Commit a09dcd9

Browse files
committed
Fix some indentation and idioms in rope.rs
Sorry for the pedantry. I was handling a compilation bug related to this code, and it just jumped out at me.
1 parent 9ff6f81 commit a09dcd9

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

src/lib/rope.rs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,31 +1196,23 @@ mod node {
11961196
proportional to the height of the rope + the (bounded)
11971197
length of the largest leaf.
11981198
*/
1199-
fn char_at(node: @node, pos: uint) -> char {
1200-
let node = node;
1201-
let pos = pos;
1202-
while true {
1203-
alt(*node) {
1204-
leaf(x) {
1205-
ret str::char_at(*x.content, pos);
1206-
}
1207-
concat({left: left,
1208-
right: right,
1209-
char_len: _,
1210-
byte_len: _,
1211-
height: _}) {
1212-
let left_len = char_len(left);
1213-
if left_len > pos {
1214-
node = left;
1215-
} else {
1216-
node = right;
1217-
pos = pos - left_len;
1218-
}
1219-
}
1220-
}
1221-
};
1222-
fail;//unreachable
1223-
}
1199+
fn char_at(node: @node, pos: uint) -> char {
1200+
let node = node;
1201+
let pos = pos;
1202+
while true {
1203+
alt *node {
1204+
leaf(x) {
1205+
ret str::char_at(*x.content, pos);
1206+
}
1207+
concat({left, right, _}) {
1208+
let left_len = char_len(left);
1209+
node = if left_len > pos { left }
1210+
else { pos -= left_len; right };
1211+
}
1212+
}
1213+
}
1214+
fail;//unreachable
1215+
}
12241216

12251217
mod leaf_iterator {
12261218
type t = {

0 commit comments

Comments
 (0)