Fallout of std::str stabilization

This commit is contained in:
Alex Crichton 2014-12-10 19:46:38 -08:00
parent 4908017d59
commit 082bfde412
193 changed files with 2143 additions and 2230 deletions

View file

@ -291,9 +291,9 @@ impl FileMap {
lines.get(line_number).map(|&line| {
let begin: BytePos = line - self.start_pos;
let begin = begin.to_uint();
let slice = self.src.slice_from(begin);
let slice = self.src[begin..];
match slice.find('\n') {
Some(e) => slice.slice_to(e),
Some(e) => slice[0..e],
None => slice
}.to_string()
})
@ -338,9 +338,9 @@ impl CodeMap {
// FIXME #12884: no efficient/safe way to remove from the start of a string
// and reuse the allocation.
let mut src = if src.starts_with("\u{feff}") {
String::from_str(src.slice_from(3))
String::from_str(src[3..])
} else {
String::from_str(src.as_slice())
String::from_str(src[])
};
// Append '\n' in case it's not already there.
@ -427,8 +427,8 @@ impl CodeMap {
if begin.fm.start_pos != end.fm.start_pos {
None
} else {
Some(begin.fm.src.slice(begin.pos.to_uint(),
end.pos.to_uint()).to_string())
Some(begin.fm.src[begin.pos.to_uint()..
end.pos.to_uint()].to_string())
}
}