23
23
* * access to a character by index is logarithmic (linear in strings);
24
24
*/
25
25
26
+ #[ forbid( deprecated_mode) ] ;
27
+ #[ forbid( deprecated_pattern) ] ;
26
28
27
29
/// The type of ropes.
28
30
type rope = node:: root ;
@@ -436,7 +438,7 @@ mod iterator {
436
438
node:: content( x) => return node:: leaf_iterator:: start ( x)
437
439
}
438
440
}
439
- fn next ( it : node:: leaf_iterator:: t ) -> Option < node:: leaf > {
441
+ fn next ( it : & node:: leaf_iterator:: t ) -> Option < node:: leaf > {
440
442
return node:: leaf_iterator:: next ( it) ;
441
443
}
442
444
}
@@ -447,7 +449,7 @@ mod iterator {
447
449
node:: content( x) => return node:: char_iterator:: start ( x)
448
450
}
449
451
}
450
- fn next ( it : node:: char_iterator:: t ) -> Option < char > {
452
+ fn next ( it : & node:: char_iterator:: t ) -> Option < char > {
451
453
return node:: char_iterator:: next ( it)
452
454
}
453
455
}
@@ -751,7 +753,7 @@ mod node {
751
753
* * forest - The forest. This vector is progressively rewritten during
752
754
* execution and should be discarded as meaningless afterwards.
753
755
*/
754
- fn tree_from_forest_destructive ( forest : ~ [ mut @node] ) -> @node {
756
+ fn tree_from_forest_destructive ( forest : & [ mut @node] ) -> @node {
755
757
let mut i;
756
758
let mut len = vec:: len ( forest) ;
757
759
while len > 1 u {
@@ -800,7 +802,7 @@ mod node {
800
802
let mut offset = 0 u; //Current position in the buffer
801
803
let it = leaf_iterator:: start ( node) ;
802
804
loop {
803
- match ( leaf_iterator:: next ( it) ) {
805
+ match ( leaf_iterator:: next ( & it) ) {
804
806
option:: None => break ,
805
807
option:: Some ( x) => {
806
808
//FIXME (#2744): Replace with memcpy or something similar
@@ -861,7 +863,7 @@ mod node {
861
863
let mut forest = ~[ mut] ;
862
864
let it = leaf_iterator:: start ( node) ;
863
865
loop {
864
- match ( leaf_iterator:: next ( it) ) {
866
+ match ( leaf_iterator:: next ( & it) ) {
865
867
option:: None => break ,
866
868
option:: Some ( x) => vec:: push ( forest, @leaf ( x) )
867
869
}
@@ -1018,7 +1020,7 @@ mod node {
1018
1020
let itb = char_iterator:: start ( b) ;
1019
1021
let mut result = 0 ;
1020
1022
while result == 0 {
1021
- match ( ( char_iterator:: next ( ita) , char_iterator:: next ( itb) ) ) {
1023
+ match ( ( char_iterator:: next ( & ita) , char_iterator:: next ( & itb) ) ) {
1022
1024
( option:: None , option:: None ) => break ,
1023
1025
( option:: Some ( chara) , option:: Some ( charb) ) => {
1024
1026
result = char:: cmp ( chara, charb) ;
@@ -1121,7 +1123,7 @@ mod node {
1121
1123
}
1122
1124
}
1123
1125
1124
- fn next ( it : t ) -> Option < leaf > {
1126
+ fn next ( it : & t ) -> Option < leaf > {
1125
1127
if it. stackpos < 0 { return option:: None ; }
1126
1128
loop {
1127
1129
let current = it. stack [ it. stackpos ] ;
@@ -1162,7 +1164,7 @@ mod node {
1162
1164
}
1163
1165
}
1164
1166
1165
- fn next ( it : t ) -> Option < char > {
1167
+ fn next ( it : & t ) -> Option < char > {
1166
1168
loop {
1167
1169
match ( get_current_or_next_leaf ( it) ) {
1168
1170
option:: None => return option:: None ,
@@ -1177,36 +1179,36 @@ mod node {
1177
1179
} ;
1178
1180
}
1179
1181
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 ,
1183
1185
option:: None => {
1184
- let next = leaf_iterator:: next ( it . leaf_iterator ) ;
1186
+ let next = leaf_iterator:: next ( & ( ( * it ) . leaf_iterator ) ) ;
1185
1187
match ( next) {
1186
1188
option:: None => return option:: None ,
1187
1189
option:: Some ( _) => {
1188
- it . leaf = next;
1189
- it . leaf_byte_pos = 0 u;
1190
+ ( * it ) . leaf = next;
1191
+ ( * it ) . leaf_byte_pos = 0 u;
1190
1192
return next;
1191
1193
}
1192
1194
}
1193
1195
}
1194
1196
}
1195
1197
}
1196
1198
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 {
1199
1201
option:: None => return option:: None ,
1200
1202
option:: Some ( aleaf) => {
1201
- if it . leaf_byte_pos >= aleaf. byte_len {
1203
+ if ( * it ) . leaf_byte_pos >= aleaf. byte_len {
1202
1204
//We are actually past the end of the leaf
1203
- it . leaf = option:: None ;
1205
+ ( * it ) . leaf = option:: None ;
1204
1206
return option:: None
1205
1207
} else {
1206
1208
let { ch, next} =
1207
1209
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 ;
1210
1212
return option:: Some ( ch)
1211
1213
}
1212
1214
}
@@ -1274,7 +1276,7 @@ mod tests {
1274
1276
let rope_iter = iterator:: char:: start ( r) ;
1275
1277
let mut equal = true ;
1276
1278
while equal {
1277
- match ( node:: char_iterator:: next ( rope_iter) ) {
1279
+ match ( node:: char_iterator:: next ( & rope_iter) ) {
1278
1280
option:: None => {
1279
1281
if string_iter < string_len {
1280
1282
equal = false ;
@@ -1301,7 +1303,7 @@ mod tests {
1301
1303
let mut len = 0 u;
1302
1304
let it = iterator:: char:: start ( r) ;
1303
1305
loop {
1304
- match ( node:: char_iterator:: next ( it) ) {
1306
+ match ( node:: char_iterator:: next ( & it) ) {
1305
1307
option:: None => break ,
1306
1308
option:: Some ( _) => len += 1 u
1307
1309
}
0 commit comments