diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-07-02 08:33:35 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-07-02 08:33:35 +0800 |
commit | af7a09c53faf9ebeeb8c0a15278b510738d1f34f (patch) | |
tree | b111f49ee3ee6bed4044138e68662786635762dc /src/main.rs | |
parent | 9ac025f7e546514581aaa96f96b8af476988d384 (diff) |
Use 'anyhow' instead of 'failure' to simplify code and reduce bloat
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 3630be3..8104490 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,8 @@ #![forbid(unsafe_code)] #![allow(clippy::match_bool)] use crate::interactive::{Interaction, TerminalApp}; +use anyhow::{Context, Result}; use dua::{ByteFormat, Color, TraversalSorting}; -use failure::{Error, ResultExt}; -use failure_tools::ok_or_exit; use std::{fs, io, io::Write, path::PathBuf, process}; use termion::{raw::IntoRawMode, screen::AlternateScreen}; use tui::backend::TermionBackend; @@ -12,7 +11,7 @@ use tui_react::Terminal; mod interactive; mod options; -fn run() -> Result<(), Error> { +fn main() -> Result<()> { use options::*; let opt: options::Args = argh::from_env(); @@ -35,7 +34,7 @@ fn run() -> Result<(), Error> { let mut terminal = { let stdout = io::stdout() .into_raw_mode() - .with_context(|_| "Interactive mode requires a connected terminal")?; + .with_context(|| "Interactive mode requires a connected terminal")?; let stdout = AlternateScreen::from(stdout); let backend = TermionBackend::new(stdout); Terminal::new(backend)? @@ -129,7 +128,3 @@ fn cwd_dirlist() -> Result<Vec<PathBuf>, io::Error> { v.sort(); Ok(v) } - -fn main() { - ok_or_exit(run()) -} |