From 3a8069d1a46578c810f24c7b1b092251ffc22c39 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 9 Jan 2020 12:05:15 +0100 Subject: Even more stuff --- src/error.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index 6358bfe..19bd48d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,19 +4,8 @@ pub trait IntoIOError { fn ioerr(self) -> io::Error; } -impl IntoIOError for String { - fn ioerr(self) -> io::Error { - io::Error::new(io::ErrorKind::Other, self) - } -} - -impl IntoIOError for &str { - fn ioerr(self) -> io::Error { - io::Error::new(io::ErrorKind::Other, self) - } -} - -impl IntoIOError for std::string::FromUtf8Error { +// This impl bound is taken directly from the io::Error::new function. +impl>> IntoIOError for E { fn ioerr(self) -> io::Error { io::Error::new(io::ErrorKind::Other, self) } -- cgit v1.2.3