Skip to content

Commit 34bf846

Browse files
committed
Remove deprecated modes from rope.rs
1 parent e2667fd commit 34bf846

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

src/libstd/rope.rs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
* * access to a character by index is logarithmic (linear in strings);
2424
*/
2525

26+
#[forbid(deprecated_mode)];
27+
#[forbid(deprecated_pattern)];
2628

2729
/// The type of ropes.
2830
type rope = node::root;
@@ -436,7 +438,7 @@ mod iterator {
436438
node::content(x) => return node::leaf_iterator::start(x)
437439
}
438440
}
439-
fn next(it: node::leaf_iterator::t) -> Option<node::leaf> {
441+
fn next(it: &node::leaf_iterator::t) -> Option<node::leaf> {
440442
return node::leaf_iterator::next(it);
441443
}
442444
}
@@ -447,7 +449,7 @@ mod iterator {
447449
node::content(x) => return node::char_iterator::start(x)
448450
}
449451
}
450-
fn next(it: node::char_iterator::t) -> Option<char> {
452+
fn next(it: &node::char_iterator::t) -> Option<char> {
451453
return node::char_iterator::next(it)
452454
}
453455
}
@@ -751,7 +753,7 @@ mod node {
751753
* * forest - The forest. This vector is progressively rewritten during
752754
* execution and should be discarded as meaningless afterwards.
753755
*/
754-
fn tree_from_forest_destructive(forest: ~[mut @node]) -> @node {
756+
fn tree_from_forest_destructive(forest: &[mut @node]) -> @node {
755757
let mut i;
756758
let mut len = vec::len(forest);
757759
while len > 1u {
@@ -800,7 +802,7 @@ mod node {
800802
let mut offset = 0u;//Current position in the buffer
801803
let it = leaf_iterator::start(node);
802804
loop {
803-
match (leaf_iterator::next(it)) {
805+
match (leaf_iterator::next(&it)) {
804806
option::None => break,
805807
option::Some(x) => {
806808
//FIXME (#2744): Replace with memcpy or something similar
@@ -861,7 +863,7 @@ mod node {
861863
let mut forest = ~[mut];
862864
let it = leaf_iterator::start(node);
863865
loop {
864-
match (leaf_iterator::next(it)) {
866+
match (leaf_iterator::next(&it)) {
865867
option::None => break,
866868
option::Some(x) => vec::push(forest, @leaf(x))
867869
}
@@ -1018,7 +1020,7 @@ mod node {
10181020
let itb = char_iterator::start(b);
10191021
let mut result = 0;
10201022
while result == 0 {
1021-
match ((char_iterator::next(ita), char_iterator::next(itb))) {
1023+
match ((char_iterator::next(&ita), char_iterator::next(&itb))) {
10221024
(option::None, option::None) => break,
10231025
(option::Some(chara), option::Some(charb)) => {
10241026
result = char::cmp(chara, charb);
@@ -1121,7 +1123,7 @@ mod node {
11211123
}
11221124
}
11231125

1124-
fn next(it: t) -> Option<leaf> {
1126+
fn next(it: &t) -> Option<leaf> {
11251127
if it.stackpos < 0 { return option::None; }
11261128
loop {
11271129
let current = it.stack[it.stackpos];
@@ -1162,7 +1164,7 @@ mod node {
11621164
}
11631165
}
11641166

1165-
fn next(it: t) -> Option<char> {
1167+
fn next(it: &t) -> Option<char> {
11661168
loop {
11671169
match (get_current_or_next_leaf(it)) {
11681170
option::None => return option::None,
@@ -1177,36 +1179,36 @@ mod node {
11771179
};
11781180
}
11791181

1180-
fn get_current_or_next_leaf(it: t) -> Option<leaf> {
1181-
match (it.leaf) {
1182-
option::Some(_) => return it.leaf,
1182+
fn get_current_or_next_leaf(it: &t) -> Option<leaf> {
1183+
match ((*it).leaf) {
1184+
option::Some(_) => return (*it).leaf,
11831185
option::None => {
1184-
let next = leaf_iterator::next(it.leaf_iterator);
1186+
let next = leaf_iterator::next(&((*it).leaf_iterator));
11851187
match (next) {
11861188
option::None => return option::None,
11871189
option::Some(_) => {
1188-
it.leaf = next;
1189-
it.leaf_byte_pos = 0u;
1190+
(*it).leaf = next;
1191+
(*it).leaf_byte_pos = 0u;
11901192
return next;
11911193
}
11921194
}
11931195
}
11941196
}
11951197
}
11961198

1197-
fn get_next_char_in_leaf(it: t) -> Option<char> {
1198-
match copy it.leaf {
1199+
fn get_next_char_in_leaf(it: &t) -> Option<char> {
1200+
match copy (*it).leaf {
11991201
option::None => return option::None,
12001202
option::Some(aleaf) => {
1201-
if it.leaf_byte_pos >= aleaf.byte_len {
1203+
if (*it).leaf_byte_pos >= aleaf.byte_len {
12021204
//We are actually past the end of the leaf
1203-
it.leaf = option::None;
1205+
(*it).leaf = option::None;
12041206
return option::None
12051207
} else {
12061208
let {ch, next} =
12071209
str::char_range_at(*aleaf.content,
1208-
it.leaf_byte_pos + aleaf.byte_offset);
1209-
it.leaf_byte_pos = next - aleaf.byte_offset;
1210+
(*it).leaf_byte_pos + aleaf.byte_offset);
1211+
(*it).leaf_byte_pos = next - aleaf.byte_offset;
12101212
return option::Some(ch)
12111213
}
12121214
}
@@ -1274,7 +1276,7 @@ mod tests {
12741276
let rope_iter = iterator::char::start(r);
12751277
let mut equal = true;
12761278
while equal {
1277-
match (node::char_iterator::next(rope_iter)) {
1279+
match (node::char_iterator::next(&rope_iter)) {
12781280
option::None => {
12791281
if string_iter < string_len {
12801282
equal = false;
@@ -1301,7 +1303,7 @@ mod tests {
13011303
let mut len = 0u;
13021304
let it = iterator::char::start(r);
13031305
loop {
1304-
match (node::char_iterator::next(it)) {
1306+
match (node::char_iterator::next(&it)) {
13051307
option::None => break,
13061308
option::Some(_) => len += 1u
13071309
}

src/libstd/tempfile.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//! Temporary files and directories
22
3+
#[forbid(deprecated_mode)];
4+
#[forbid(deprecated_pattern)];
5+
36
import core::option;
47
import option::{None, Some};
58
import rand;

0 commit comments

Comments
 (0)