std: convert character-based str::find_* to methods. Add .slice_{to,from} methods.
This commit is contained in:
@@ -24,7 +24,6 @@ source code snippets, etc.
|
||||
use core::prelude::*;
|
||||
|
||||
use core::cmp;
|
||||
use core::str;
|
||||
use core::to_bytes;
|
||||
use core::uint;
|
||||
use extra::serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
@@ -288,11 +287,11 @@ impl FileMap {
|
||||
pub fn get_line(&self, line: int) -> ~str {
|
||||
let begin: BytePos = self.lines[line] - self.start_pos;
|
||||
let begin = begin.to_uint();
|
||||
let end = match str::find_char_from(*self.src, '\n', begin) {
|
||||
Some(e) => e,
|
||||
None => self.src.len()
|
||||
};
|
||||
self.src.slice(begin, end).to_owned()
|
||||
let slice = self.src.slice_from(begin);
|
||||
match slice.find('\n') {
|
||||
Some(e) => slice.slice_to(e).to_owned(),
|
||||
None => slice.to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn record_multibyte_char(&self, pos: BytePos, bytes: uint) {
|
||||
|
||||
Reference in New Issue
Block a user