1.5.5 - fix warnings

This commit is contained in:
Jeremy Soller 2020-01-20 11:12:03 -07:00
parent 6cb4e3fb75
commit a448f510f0
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
4 changed files with 10 additions and 8 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "termion"
version = "1.5.4"
version = "1.5.5"
authors = ["ticki <Ticki@users.noreply.github.com>", "gycos <alexandre.bury@gmail.com>", "IGI-111 <igi-111@protonmail.com>"]
description = "A bindless library for manipulating terminals."
repository = "https://gitlab.redox-os.org/redox-os/termion"

View File

@ -119,8 +119,8 @@ pub fn parse_event<I>(item: u8, iter: &mut I) -> Result<Event, Error>
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<I>(item: u8, iter: &mut I) -> Result<Event, Error>
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))
})
}
}

View File

@ -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<W: Write>(&mut self, writer: &mut W) -> io::Result<Option<String>> {
let _raw = try!(writer.into_raw_mode());
let _raw = writer.into_raw_mode()?;
self.read_line()
}
}
@ -152,8 +152,8 @@ impl<R: Read + TermReadEventsAndRaw> 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))
}
}

View File

@ -102,11 +102,13 @@ impl<W: Write> IntoRawMode for W {
}
impl<W: Write> RawTerminal<W> {
/// 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);