From 07024537a7bbeb7012f46f5aec19affd846dbd4f Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Fri, 12 Jun 2020 15:38:16 +0900 Subject: [PATCH 1/2] Switch failure to anyhow --- intel-mkl-tool/Cargo.toml | 8 ++++---- intel-mkl-tool/src/cli.rs | 4 ++-- intel-mkl-tool/src/lib.rs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/intel-mkl-tool/Cargo.toml b/intel-mkl-tool/Cargo.toml index 3d13772e..941bd0c1 100644 --- a/intel-mkl-tool/Cargo.toml +++ b/intel-mkl-tool/Cargo.toml @@ -14,13 +14,13 @@ default = ["cli"] cli = ["structopt", "env_logger"] [dependencies] +anyhow = "1.0.31" curl = "0.4.25" -failure = "0.1.6" -pkg-config = "0.3.17" -tar = "0.4.26" -log = "0.4.8" dirs = "2.0.2" glob = "0.3.0" +log = "0.4.8" +pkg-config = "0.3.17" +tar = "0.4.26" zstd = "0.5.1" # CLI diff --git a/intel-mkl-tool/src/cli.rs b/intel-mkl-tool/src/cli.rs index b91315cb..7802a408 100644 --- a/intel-mkl-tool/src/cli.rs +++ b/intel-mkl-tool/src/cli.rs @@ -1,4 +1,4 @@ -use failure::*; +use anyhow::*; use std::{env, path::PathBuf}; use structopt::StructOpt; @@ -22,7 +22,7 @@ enum Opt { Package { path: PathBuf }, } -fn main() -> Fallible<()> { +fn main() -> Result<()> { env::set_var("RUST_LOG", "info"); env_logger::init(); diff --git a/intel-mkl-tool/src/lib.rs b/intel-mkl-tool/src/lib.rs index 47e8b927..a4a954b6 100644 --- a/intel-mkl-tool/src/lib.rs +++ b/intel-mkl-tool/src/lib.rs @@ -1,5 +1,5 @@ use curl::easy::Easy; -use failure::*; +use anyhow::*; use glob::glob; use log::*; use std::{ @@ -68,7 +68,7 @@ pub fn seek_home() -> Option { None } -pub fn download(out_dir: &Path) -> Fallible<()> { +pub fn download(out_dir: &Path) -> Result<()> { if !out_dir.exists() { info!("Create output directory: {}", out_dir.display()); fs::create_dir_all(out_dir)?; @@ -106,7 +106,7 @@ pub fn download(out_dir: &Path) -> Fallible<()> { } // Read mkl_version.h to get MKL version (e.g. 2019.5) -fn get_mkl_version(version_header: &Path) -> Fallible<(u32, u32)> { +fn get_mkl_version(version_header: &Path) -> Result<(u32, u32)> { if !version_header.exists() { bail!("MKL Version file not found: {}", version_header.display()); } @@ -133,7 +133,7 @@ fn get_mkl_version(version_header: &Path) -> Fallible<(u32, u32)> { Ok((year, update)) } -pub fn package(mkl_path: &Path) -> Fallible { +pub fn package(mkl_path: &Path) -> Result { if !mkl_path.exists() { bail!("MKL directory not found: {}", mkl_path.display()); } From 398c01fa9b2b093a98868309a9a9e762f33cc678 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Fri, 12 Jun 2020 15:39:39 +0900 Subject: [PATCH 2/2] cargo-fmt --- intel-mkl-tool/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intel-mkl-tool/src/lib.rs b/intel-mkl-tool/src/lib.rs index a4a954b6..0e57a3b3 100644 --- a/intel-mkl-tool/src/lib.rs +++ b/intel-mkl-tool/src/lib.rs @@ -1,5 +1,5 @@ -use curl::easy::Easy; use anyhow::*; +use curl::easy::Easy; use glob::glob; use log::*; use std::{