From ab0cdc0df3305f8fdb49982fe0ff704594a67557 Mon Sep 17 00:00:00 2001 From: syn Date: Fri, 17 Jan 2020 21:50:47 +0300 Subject: Use io error types directly --- src/backends/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backends/mod.rs b/src/backends/mod.rs index 82ec6a7..b91bde5 100644 --- a/src/backends/mod.rs +++ b/src/backends/mod.rs @@ -1,6 +1,7 @@ use std::path::{ Path, PathBuf }; use std::env::temp_dir; use lazy_static::lazy_static; +use std::io::{ Error, ErrorKind, Result }; pub mod python; pub mod clang; @@ -15,7 +16,7 @@ lazy_static! { pub trait Backend { fn get_template(&self) -> Option<&str>; - fn run(&self, fname: &Path) -> std::io::Result<()>; + fn run(&self, fname: &Path) -> Result<()>; fn try_guess_test_file(&self, fname: &Path) -> Option { let maybe_test = fname.with_extension("txt"); @@ -26,12 +27,12 @@ pub trait Backend { } } -fn mk_tmp_dir() -> std::io::Result<&'static std::path::PathBuf> { +fn mk_tmp_dir() -> Result<&'static std::path::PathBuf> { if !EVR_TMP_DIR.exists() { std::fs::create_dir(&*EVR_TMP_DIR)?; } else { if !EVR_TMP_DIR.is_dir() { - return Err(std::io::Error::new(std::io::ErrorKind::AlreadyExists, + return Err(Error::new(ErrorKind::AlreadyExists, "tmp dir already exists and not a directory")) } } -- cgit v1.2.1-18-gbd029