From c5339d01cfdc6526d99463ee0ede4054ea55af17 Mon Sep 17 00:00:00 2001 From: Marcin Mielniczuk Date: Sun, 8 Sep 2019 09:38:03 +0200 Subject: [PATCH] refactor errno_from_ioerror --- src/error.rs | 11 ++++++++++- src/sys/mod.rs | 10 ---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/error.rs b/src/error.rs index cd8932e854..3970e3729f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,4 @@ use crate::host; -use crate::sys::errno_from_ioerror; use failure::Fail; use std::convert::Infallible; use std::fmt; @@ -254,3 +253,13 @@ impl fmt::Display for Error { } } } + +fn errno_from_ioerror(e: &std::io::Error) -> host::__wasi_errno_t { + match e.raw_os_error() { + Some(code) => crate::sys::errno_from_host(code), + None => { + log::debug!("Inconvertible OS error: {}", e); + host::__WASI_EIO + } + } +} diff --git a/src/sys/mod.rs b/src/sys/mod.rs index 17f8d09783..dce0bd5362 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -22,13 +22,3 @@ cfg_if! { compile_error!("wasi-common doesn't compile for this platform yet"); } } - -pub(crate) fn errno_from_ioerror(e: &std::io::Error) -> host::__wasi_errno_t { - match e.raw_os_error() { - Some(code) => errno_from_host(code), - None => { - log::debug!("Inconvertible OS error: {}", e); - host::__WASI_EIO - } - } -}