diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-15 13:31:44 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-15 13:32:35 +0100 |
| commit | a09dcd94c5809bd5cbedd5c06218e8db25c2881a (patch) | |
| tree | 6633a05f9d137efc59b8452d0e7be564b9fe3efd | |
| parent | 9ff6f816ba5e9a1a32fc7e15a5b30f5b057ed199 (diff) | |
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.
| -rw-r--r-- | src/lib/rope.rs | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/src/lib/rope.rs b/src/lib/rope.rs index 45df908a52d..19819a968bf 100644 --- a/src/lib/rope.rs +++ b/src/lib/rope.rs @@ -1196,31 +1196,23 @@ mod node { proportional to the height of the rope + the (bounded) length of the largest leaf. */ - fn char_at(node: @node, pos: uint) -> char { - let node = node; - let pos = pos; - while true { - alt(*node) { - leaf(x) { - ret str::char_at(*x.content, pos); - } - concat({left: left, - right: right, - char_len: _, - byte_len: _, - height: _}) { - let left_len = char_len(left); - if left_len > pos { - node = left; - } else { - node = right; - pos = pos - left_len; - } - } - } - }; - fail;//unreachable - } + fn char_at(node: @node, pos: uint) -> char { + let node = node; + let pos = pos; + while true { + alt *node { + leaf(x) { + ret str::char_at(*x.content, pos); + } + concat({left, right, _}) { + let left_len = char_len(left); + node = if left_len > pos { left } + else { pos -= left_len; right }; + } + } + } + fail;//unreachable + } mod leaf_iterator { type t = { |
