diff options
Diffstat (limited to 'safe_libc/src')
-rw-r--r-- | safe_libc/src/stdio.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/safe_libc/src/stdio.rs b/safe_libc/src/stdio.rs index be016ab..2942405 100644 --- a/safe_libc/src/stdio.rs +++ b/safe_libc/src/stdio.rs @@ -7,6 +7,12 @@ pub struct Error { pub errno: errno::Errno, } +impl From<Error> for fmt::Error { + fn from(_err: Error) -> fmt::Error { + fmt::Error + } +} + pub type Result<T> = core::result::Result<T, Error>; #[inline] @@ -58,9 +64,7 @@ impl BasicOStream { impl fmt::Write for BasicOStream { #[inline] fn write_str(&mut self, s: &str) -> fmt::Result { - if self.write(s.as_bytes()).is_err() { - return Err(fmt::Error); - } + self.write(s.as_bytes())?; Ok(()) } } |