about summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/buffered.rs14
-rw-r--r--src/libstd/io/fs.rs4
-rw-r--r--src/libstd/io/mod.rs4
-rw-r--r--src/libstd/io/net/ip.rs12
-rw-r--r--src/libstd/io/stdio.rs2
5 files changed, 18 insertions, 18 deletions
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index e25006a7b39..71ec5242118 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -248,7 +248,7 @@ impl<W: Writer> LineBufferedWriter<W> {
 
 impl<W: Writer> Writer for LineBufferedWriter<W> {
     fn write(&mut self, buf: &[u8]) -> IoResult<()> {
-        match buf.iter().rposition(|&b| b == '\n' as u8) {
+        match buf.iter().rposition(|&b| b == b'\n') {
             Some(i) => {
                 try!(self.inner.write(buf.slice_to(i + 1)));
                 try!(self.inner.flush());
@@ -524,15 +524,15 @@ mod test {
         assert_eq!(writer.get_ref().get_ref(), &[]);
         writer.flush().unwrap();
         assert_eq!(writer.get_ref().get_ref(), &[0, 1]);
-        writer.write([0, '\n' as u8, 1, '\n' as u8, 2]).unwrap();
+        writer.write([0, b'\n', 1, b'\n', 2]).unwrap();
         assert_eq!(writer.get_ref().get_ref(),
-                   &[0, 1, 0, '\n' as u8, 1, '\n' as u8]);
+                   &[0, 1, 0, b'\n', 1, b'\n']);
         writer.flush().unwrap();
         assert_eq!(writer.get_ref().get_ref(),
-                   &[0, 1, 0, '\n' as u8, 1, '\n' as u8, 2]);
-        writer.write([3, '\n' as u8]).unwrap();
+                   &[0, 1, 0, b'\n', 1, b'\n', 2]);
+        writer.write([3, b'\n']).unwrap();
         assert_eq!(writer.get_ref().get_ref(),
-            &[0, 1, 0, '\n' as u8, 1, '\n' as u8, 2, 3, '\n' as u8]);
+            &[0, 1, 0, b'\n', 1, b'\n', 2, 3, b'\n']);
     }
 
     #[test]
@@ -579,7 +579,7 @@ mod test {
 
     #[test]
     fn test_chars() {
-        let buf = [195u8, 159u8, 'a' as u8];
+        let buf = [195u8, 159u8, b'a'];
         let mut reader = BufferedReader::with_capacity(1, BufReader::new(buf));
         let mut it = reader.chars();
         assert_eq!(it.next(), Some(Ok('ß')));
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs
index 246ff901f5c..6a4172d5c35 100644
--- a/src/libstd/io/fs.rs
+++ b/src/libstd/io/fs.rs
@@ -1241,8 +1241,8 @@ mod test {
         let mut cur = [0u8, .. 2];
         for f in files {
             let stem = f.filestem_str().unwrap();
-            let root = stem.as_bytes()[0] - ('0' as u8);
-            let name = stem.as_bytes()[1] - ('0' as u8);
+            let root = stem.as_bytes()[0] - b'0';
+            let name = stem.as_bytes()[1] - b'0';
             assert!(cur[root as uint] < name);
             cur[root as uint] = name;
         }
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index f1b92b973c8..d098f9a6479 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -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)),
diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs
index 79caded6711..0f864c7be5e 100644
--- a/src/libstd/io/net/ip.rs
+++ b/src/libstd/io/net/ip.rs
@@ -161,12 +161,12 @@ impl<'a> Parser<'a> {
         fn parse_digit(c: char, radix: u8) -> Option<u8> {
             let c = c as u8;
             // assuming radix is either 10 or 16
-            if c >= '0' as u8 && c <= '9' as u8 {
-                Some(c - '0' as u8)
-            } else if radix > 10 && c >= 'a' as u8 && c < 'a' as u8 + (radix - 10) {
-                Some(c - 'a' as u8 + 10)
-            } else if radix > 10 && c >= 'A' as u8 && c < 'A' as u8 + (radix - 10) {
-                Some(c - 'A' as u8 + 10)
+            if c >= b'0' && c <= b'9' {
+                Some(c - b'0')
+            } else if radix > 10 && c >= b'a' && c < b'a' + (radix - 10) {
+                Some(c - b'a' + 10)
+            } else if radix > 10 && c >= b'A' && c < b'A' + (radix - 10) {
+                Some(c - b'A' + 10)
             } else {
                 None
             }
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index 45c084b3459..e0201b65071 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -239,7 +239,7 @@ pub fn print(s: &str) {
 /// `\n` character is printed to the console after the string.
 pub fn println(s: &str) {
     with_task_stdout(|io| {
-        io.write(s.as_bytes()).and_then(|()| io.write(['\n' as u8]))
+        io.write(s.as_bytes()).and_then(|()| io.write([b'\n']))
     })
 }