From f9d4bdda8bcbf13fc1390fb6d1634bf2de598a4e Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 3 Jan 2022 13:21:13 +0100 Subject: [PATCH] switch to anyhow, don't use old style imports Signed-off-by: Wolfgang Bumiller --- Cargo.toml | 2 +- src/main.rs | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d5b185e..a4499b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ homepage = "https://www.proxmox.com" exclude = [ "build", "debian" ] [dependencies] +anyhow = "1" clap = "2.32" -failure = "0.1.5" flate2 = "1.0" libc = "0.2.48" time = "0.1.42" diff --git a/src/main.rs b/src/main.rs index 419257b..daf0738 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,3 @@ -#[macro_use] -extern crate clap; -extern crate failure; -extern crate flate2; -extern crate libc; - use std::cell::RefCell; use std::collections::HashMap; use std::ffi::CString; @@ -15,15 +9,15 @@ use std::io::BufReader; use std::io::BufWriter; use std::io::Write; -use failure::Error; +use anyhow::{bail, Error}; use flate2::read; use clap::{App, Arg}; fn main() -> Result<(), Error> { - let matches = App::new(crate_name!()) - .version(crate_version!()) - .about(crate_description!()) + let matches = App::new(clap::crate_name!()) + .version(clap::crate_version!()) + .about(clap::crate_description!()) .arg( Arg::with_name("verbose") .short("v") @@ -1996,7 +1990,7 @@ impl Parser { self.options.start = mkgmtime(&res); self.start_tm = res; } else { - failure::bail!(failure::err_msg("failed to parse start time")); + bail!("failed to parse start time"); } } else { let mut ltime = time::now(); @@ -2016,7 +2010,7 @@ impl Parser { self.options.end = mkgmtime(&res); self.end_tm = res; } else { - failure::bail!(failure::err_msg("failed to parse end time")); + bail!("failed to parse end time"); } } else { let ltime = time::now(); @@ -2025,7 +2019,7 @@ impl Parser { } if self.options.end < self.options.start { - failure::bail!(failure::err_msg("end time before start time")); + bail!("end time before start time"); } self.options.limit = match args.value_of("limit") { -- 2.39.5