From 7da5fbf36ffd100a043a1917ffe9e41218ba878c Mon Sep 17 00:00:00 2001 From: Ticki Date: Sun, 20 Mar 2016 22:55:08 +0100 Subject: [PATCH] Clean up imports in raw module --- src/raw.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/raw.rs b/src/raw.rs index 4a6bed3..97ab850 100644 --- a/src/raw.rs +++ b/src/raw.rs @@ -1,4 +1,4 @@ -use std::io::{Write, Error, ErrorKind, Result as IoResult}; +use std::io::{self, Write}; use std::ops::{Deref, DerefMut}; /// A terminal restorer, which keeps the previous state of the terminal, and restores it, when @@ -12,7 +12,7 @@ pub struct RawTerminal { impl Drop for RawTerminal { fn drop(&mut self) { use control::TermWrite; - self.csi(b"R"); + let _ = self.csi(b"R"); } } @@ -48,11 +48,11 @@ impl DerefMut for RawTerminal { } impl Write for RawTerminal { - fn write(&mut self, buf: &[u8]) -> IoResult { + fn write(&mut self, buf: &[u8]) -> io::Result { self.output.write(buf) } - fn flush(&mut self) -> IoResult<()> { + fn flush(&mut self) -> io::Result<()> { self.output.flush() } } @@ -64,18 +64,18 @@ pub trait IntoRawMode: Write + Sized { /// Raw mode means that stdin won't be printed (it will instead have to be written manually by the /// program). Furthermore, the input isn't canonicalised or buffered (that is, you can read from /// stdin one byte of a time). The output is neither modified in any way. - fn into_raw_mode(self) -> IoResult>; + fn into_raw_mode(self) -> io::Result>; } impl IntoRawMode for W { #[cfg(not(target_os = "redox"))] - fn into_raw_mode(self) -> IoResult> { + fn into_raw_mode(self) -> io::Result> { use termios::{cfmakeraw, get_terminal_attr, set_terminal_attr}; let (mut ios, exit) = get_terminal_attr(); let prev_ios = ios.clone(); if exit != 0 { - return Err(Error::new(ErrorKind::Other, "Unable to get Termios attribute.")); + return Err(io::Error::new(io::ErrorKind::Other, "Unable to get Termios attribute.")); } unsafe { @@ -83,7 +83,7 @@ impl IntoRawMode for W { } if set_terminal_attr(&mut ios as *mut _) != 0 { - Err(Error::new(ErrorKind::Other, "Unable to set Termios attribute.")) + Err(io::Error::new(io::ErrorKind::Other, "Unable to set Termios attribute.")) } else { Ok(RawTerminal { prev_ios: prev_ios, @@ -92,7 +92,7 @@ impl IntoRawMode for W { } } #[cfg(target_os = "redox")] - fn into_raw_mode(mut self) -> IoResult> { + fn into_raw_mode(mut self) -> io::Result> { use control::TermWrite; self.csi(b"r").map(|_| RawTerminal {