From 3390bedee92a217754f5eb9d874e22bc69cedbe0 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sat, 13 Apr 2019 18:25:12 +0200 Subject: [PATCH] Update to Rust 2018 --- .travis.yml | 2 +- Cargo.toml | 1 + README.md | 2 +- src/main.rs | 18 +++++++++--------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2871a58..d127ac0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ matrix: # Minimum Rust supported channel. - os: linux - rust: 1.30.0 + rust: 1.31.0 env: TARGET=x86_64-unknown-linux-gnu diff --git a/Cargo.toml b/Cargo.toml index f9862ad..4467aba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ name = "hexyl" readme = "README.md" repository = "https://github.com/sharkdp/hexyl" version = "0.4.0" +edition = "2018" [dependencies] ansi_term = "0.11" diff --git a/README.md b/README.md index 819278a..ed65d19 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ you use a terminal that supports ANSI escape sequences (like PowerShell on Windo ### Via cargo -If you have Rust 1.30 or higher, you can install `hexyl` from source via `cargo`: +If you have Rust 1.31 or higher, you can install `hexyl` from source via `cargo`: ``` cargo install hexyl ``` diff --git a/src/main.rs b/src/main.rs index 4437633..a63ecbf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ #[macro_use] extern crate clap; -extern crate ansi_term; -extern crate atty; -extern crate ctrlc; + +use atty; +use ctrlc; mod squeezer; @@ -17,7 +17,7 @@ use ansi_term::Color; use ansi_term::Color::Fixed; use atty::Stream; -use squeezer::{SqueezeAction, Squeezer}; +use crate::squeezer::{SqueezeAction, Squeezer}; const BUFFER_SIZE: usize = 256; @@ -58,7 +58,7 @@ impl Byte { } fn color(self) -> &'static Color { - use ByteCategory::*; + use crate::ByteCategory::*; match self.category() { Null => &COLOR_NULL, @@ -70,7 +70,7 @@ impl Byte { } fn as_char(self) -> char { - use ByteCategory::*; + use crate::ByteCategory::*; match self.category() { Null => '0', @@ -167,11 +167,11 @@ struct Printer<'a> { impl<'a> Printer<'a> { fn new( - stdout: StdoutLock, + stdout: StdoutLock<'_>, show_color: bool, border_style: BorderStyle, use_squeeze: bool, - ) -> Printer { + ) -> Printer<'_> { Printer { idx: 1, raw_line: vec![], @@ -394,7 +394,7 @@ impl<'a> Printer<'a> { } } -fn run() -> Result<(), Box<::std::error::Error>> { +fn run() -> Result<(), Box> { let app = App::new(crate_name!()) .setting(AppSettings::ColorAuto) .setting(AppSettings::ColoredHelp)