Use byte literals in libstd

This commit is contained in:
nham
2014-08-06 02:02:50 -04:00
parent dfdea3f116
commit 3fb78e29f4
13 changed files with 52 additions and 54 deletions

View File

@@ -1103,7 +1103,7 @@ pub trait Writer {
/// that the `write` method is used specifically instead.
#[inline]
fn write_line(&mut self, s: &str) -> IoResult<()> {
self.write_str(s).and_then(|()| self.write(['\n' as u8]))
self.write_str(s).and_then(|()| self.write([b'\n']))
}
/// Write a single char, encoded as UTF-8.
@@ -1442,7 +1442,7 @@ pub trait Buffer: Reader {
/// Additionally, this function can fail if the line of input read is not a
/// valid UTF-8 sequence of bytes.
fn read_line(&mut self) -> IoResult<String> {
self.read_until('\n' as u8).and_then(|line|
self.read_until(b'\n').and_then(|line|
match String::from_utf8(line) {
Ok(s) => Ok(s),
Err(_) => Err(standard_error(InvalidInput)),