diff --git a/.travis.yml b/.travis.yml index 164405b..93d7413 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ matrix: # Minimum Rust supported channel. - os: linux - rust: 1.31.0 + rust: 1.36.0 env: TARGET=x86_64-unknown-linux-gnu diff --git a/README.md b/README.md index 10d8dc9..be5ac38 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ or Windows Terminal since Windows 10 1903). ### Via cargo -If you have Rust 1.31 or higher, you can install `hexyl` from source via `cargo`: +If you have Rust 1.36 or higher, you can install `hexyl` from source via `cargo`: ``` cargo install hexyl ``` diff --git a/src/bin/hexyl.rs b/src/bin/hexyl.rs index db0a82d..a9e8bb9 100644 --- a/src/bin/hexyl.rs +++ b/src/bin/hexyl.rs @@ -3,7 +3,6 @@ extern crate clap; use atty; -use std::cell::RefCell; use std::fs::File; use std::io::{self, prelude::*, SeekFrom}; @@ -91,7 +90,7 @@ fn run() -> Result<(), Box> { let mut reader: Input = match matches.value_of("file") { Some(filename) => Input::File(File::open(filename)?), - None => Input::Stdin(RefCell::new(stdin.lock())), + None => Input::Stdin(stdin.lock()), }; let skip_arg = matches.value_of("skip"); diff --git a/src/input.rs b/src/input.rs index 131541a..4de746b 100644 --- a/src/input.rs +++ b/src/input.rs @@ -1,17 +1,16 @@ -use std::cell::RefCell; use std::fs; use std::io::{self, Read, Seek, SeekFrom}; pub enum Input<'a> { File(fs::File), - Stdin(RefCell>), + Stdin(io::StdinLock<'a>), } impl<'a> Read for Input<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { match *self { Input::File(ref mut file) => file.read(buf), - Input::Stdin(ref mut stdin) => stdin.borrow_mut().read(buf), + Input::Stdin(ref mut stdin) => stdin.read(buf), } } } @@ -31,8 +30,8 @@ impl<'a> Seek for Input<'a> { impl<'a> Input<'a> { pub fn into_inner(self) -> Box { match self { - Self::File(file) => Box::new(file), - Self::Stdin(stdin) => Box::new(stdin.into_inner()), + Input::File(file) => Box::new(file), + Input::Stdin(stdin) => Box::new(stdin), } } }