From a448f510f0b525896fed9f14a53030203d7f19ad Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 20 Jan 2020 11:12:03 -0700 Subject: [PATCH] 1.5.5 - fix warnings --- Cargo.toml | 2 +- src/event.rs | 8 ++++---- src/input.rs | 6 +++--- src/raw.rs | 2 ++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fbb64d5..1e60cac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "termion" -version = "1.5.4" +version = "1.5.5" authors = ["ticki ", "gycos ", "IGI-111 "] description = "A bindless library for manipulating terminals." repository = "https://gitlab.redox-os.org/redox-os/termion" diff --git a/src/event.rs b/src/event.rs index cbf7dd7..8e36d5d 100644 --- a/src/event.rs +++ b/src/event.rs @@ -119,8 +119,8 @@ pub fn parse_event(item: u8, iter: &mut I) -> Result parse_csi(iter).ok_or(error)? } Some(Ok(c)) => { - let ch = parse_utf8_char(c, iter); - Event::Key(Key::Alt(try!(ch))) + let ch = parse_utf8_char(c, iter)?; + Event::Key(Key::Alt(ch)) } Some(Err(_)) | None => return Err(error), }) @@ -133,8 +133,8 @@ pub fn parse_event(item: u8, iter: &mut I) -> Result b'\0' => Ok(Event::Key(Key::Null)), c => { Ok({ - let ch = parse_utf8_char(c, iter); - Event::Key(Key::Char(try!(ch))) + let ch = parse_utf8_char(c, iter)?; + Event::Key(Key::Char(ch)) }) } } diff --git a/src/input.rs b/src/input.rs index 00f1a61..11afab5 100644 --- a/src/input.rs +++ b/src/input.rs @@ -121,7 +121,7 @@ pub trait TermRead { /// EOT and ETX will abort the prompt, returning `None`. Newline or carriage return will /// complete the input. fn read_passwd(&mut self, writer: &mut W) -> io::Result> { - let _raw = try!(writer.into_raw_mode()); + let _raw = writer.into_raw_mode()?; self.read_line() } } @@ -152,8 +152,8 @@ impl TermRead for R { } } - let string = try!(String::from_utf8(buf) - .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))); + let string = String::from_utf8(buf) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; Ok(Some(string)) } } diff --git a/src/raw.rs b/src/raw.rs index 0dbfb56..3e91696 100644 --- a/src/raw.rs +++ b/src/raw.rs @@ -102,11 +102,13 @@ impl IntoRawMode for W { } impl RawTerminal { + /// Temporarily switch to original mode pub fn suspend_raw_mode(&self) -> io::Result<()> { set_terminal_attr(&self.prev_ios)?; Ok(()) } + /// Temporarily switch to raw mode pub fn activate_raw_mode(&self) -> io::Result<()> { let mut ios = get_terminal_attr()?; raw_terminal_attr(&mut ios);