Skip to content

Switch failure to anyhow #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions intel-mkl-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions intel-mkl-tool/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use failure::*;
use anyhow::*;
use std::{env, path::PathBuf};
use structopt::StructOpt;

Expand All @@ -22,7 +22,7 @@ enum Opt {
Package { path: PathBuf },
}

fn main() -> Fallible<()> {
fn main() -> Result<()> {
env::set_var("RUST_LOG", "info");
env_logger::init();

Expand Down
8 changes: 4 additions & 4 deletions intel-mkl-tool/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::*;
use curl::easy::Easy;
use failure::*;
use glob::glob;
use log::*;
use std::{
Expand Down Expand Up @@ -68,7 +68,7 @@ pub fn seek_home() -> Option<PathBuf> {
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)?;
Expand Down Expand Up @@ -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());
}
Expand All @@ -133,7 +133,7 @@ fn get_mkl_version(version_header: &Path) -> Fallible<(u32, u32)> {
Ok((year, update))
}

pub fn package(mkl_path: &Path) -> Fallible<PathBuf> {
pub fn package(mkl_path: &Path) -> Result<PathBuf> {
if !mkl_path.exists() {
bail!("MKL directory not found: {}", mkl_path.display());
}
Expand Down