Skip to content

Commit c3318f2

Browse files
killerswanmarijnh
authored andcommitted
(core::str) rename substr_len_bytes to substr_len, and delete unused byte_index[_from]
1 parent 7782f5d commit c3318f2

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed

src/comp/syntax/codemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn lookup_byte_offset(cm: codemap::codemap, chpos: uint)
171171
let {fm,line} = lookup_line(cm,chpos,lookup);
172172
let line_offset = fm.lines[line].byte - fm.start_pos.byte;
173173
let col = chpos - fm.lines[line].ch;
174-
let col_offset = str::substr_len_bytes(*fm.src, line_offset, col);
174+
let col_offset = str::substr_len(*fm.src, line_offset, col);
175175
ret {fm: fm, pos: line_offset + col_offset};
176176
}
177177

src/libcore/str.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export
9393
// Misc
9494
// FIXME: perhaps some more of this section shouldn't be exported?
9595
is_utf8,
96-
substr_len_bytes,
96+
substr_len,
9797
substr_len_chars,
9898
utf8_char_width,
9999
char_range_at,
@@ -914,27 +914,6 @@ fn index_chars(ss: str, cc: char) -> option<uint> {
914914
ret none;
915915
}
916916

917-
// Function: byte_index
918-
//
919-
// Returns the index of the first matching byte
920-
// (as option some/none)
921-
// FIXME: delete
922-
fn byte_index(s: str, b: u8) -> option<uint> {
923-
byte_index_from(s, b, 0u, len(s))
924-
}
925-
926-
// Function: byte_index_from
927-
//
928-
// Returns the index of the first matching byte within the range [`start`,
929-
// `end`).
930-
// (as option some/none)
931-
// FIXME: delete
932-
fn byte_index_from(s: str, b: u8, start: uint, end: uint) -> option<uint> {
933-
assert end <= len(s);
934-
935-
str::as_bytes(s) { |v| vec::position_from(v, start, end) { |x| x == b } }
936-
}
937-
938917
// Function: rindex
939918
//
940919
// Returns the byte index of the first matching char

src/libstd/rope.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ mod node {
795795
if i == 0u { first_leaf_char_len }
796796
else { hint_max_leaf_char_len };
797797
let chunk_byte_len =
798-
str::substr_len_bytes(*str, offset, chunk_char_len);
798+
str::substr_len(*str, offset, chunk_char_len);
799799
nodes[i] = @leaf({
800800
byte_offset: offset,
801801
byte_len: chunk_byte_len,
@@ -1059,9 +1059,9 @@ mod node {
10591059
ret node;
10601060
}
10611061
let byte_offset =
1062-
str::substr_len_bytes(*x.content, 0u, char_offset);
1062+
str::substr_len(*x.content, 0u, char_offset);
10631063
let byte_len =
1064-
str::substr_len_bytes(*x.content, byte_offset, char_len);
1064+
str::substr_len(*x.content, byte_offset, char_len);
10651065
ret @leaf({byte_offset: byte_offset,
10661066
byte_len: byte_len,
10671067
char_len: char_len,

0 commit comments

Comments
 (0)