Removing no longer needed unsafe blocks

This commit is contained in:
Alex Crichton
2013-04-08 16:50:34 -04:00
parent 3136fba5ae
commit 255193cc1a
17 changed files with 373 additions and 477 deletions

View File

@@ -252,15 +252,13 @@ pub impl FileMap {
// get a line from the list of pre-computed line-beginnings
pub fn get_line(&self, line: int) -> ~str {
unsafe {
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 => str::len(*self.src)
};
str::slice(*self.src, begin, end).to_owned()
}
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 => str::len(*self.src)
};
str::slice(*self.src, begin, end).to_owned()
}
pub fn record_multibyte_char(&self, pos: BytePos, bytes: uint) {