diff options
| author | Chris Peterson <cpeterson@mozilla.com> | 2012-12-23 14:38:01 -0800 |
|---|---|---|
| committer | Chris Peterson <cpeterson@mozilla.com> | 2012-12-23 14:38:01 -0800 |
| commit | ffaa47736866ca89b8d23cd3f14d54efefdb6243 (patch) | |
| tree | b50b45c4598ce48f3dc62610d299ee76ba74ce88 /src/libstd/rope.rs | |
| parent | 6d8621ae7f0df0bc3878c256b98a6483fc3d9a32 (diff) | |
| download | rust-ffaa47736866ca89b8d23cd3f14d54efefdb6243.tar.gz rust-ffaa47736866ca89b8d23cd3f14d54efefdb6243.zip | |
std: Mark some functions as pure
Diffstat (limited to 'src/libstd/rope.rs')
| -rw-r--r-- | src/libstd/rope.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index 473992e6820..aa78d22e4c8 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -43,7 +43,7 @@ pub type Rope = node::Root; */ /// Create an empty rope -pub fn empty() -> Rope { +pub pure fn empty() -> Rope { return node::Empty; } @@ -479,7 +479,7 @@ pub mod iterator { * * Constant time. */ -pub fn height(rope: Rope) -> uint { +pub pure fn height(rope: Rope) -> uint { match (rope) { node::Empty => return 0u, node::Content(x) => return node::height(x) @@ -1019,7 +1019,7 @@ mod node { }) } - pub fn height(node: @Node) -> uint { + pub pure fn height(node: @Node) -> uint { match (*node) { Leaf(_) => return 0u, Concat(ref x) => return x.height @@ -1100,7 +1100,7 @@ mod node { * proportional to the height of the rope + the (bounded) * length of the largest leaf. */ - pub fn char_at(node: @Node, pos: uint) -> char { + pub pure fn char_at(node: @Node, pos: uint) -> char { let mut node = node; let mut pos = pos; loop { |
