Combine the two Error impl blocks together
We have two impl blocks for `Error`, just squash them together into a single one.
This commit is contained in:
parent
82ea4ff31d
commit
b1870656c9
|
@ -27,6 +27,16 @@ impl Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn kind(&self) -> ErrorKind { self.kind }
|
pub fn kind(&self) -> ErrorKind { self.kind }
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
pub fn get_ref(&self) -> Option<&(dyn std::error::Error + Send + Sync + 'static)> {
|
||||||
|
self.error.as_deref()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
||||||
|
pub fn get_ref(&self) -> Option<&(dyn Debug + Send + Sync + 'static)> {
|
||||||
|
self.error.as_deref()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ErrorKind> for Error {
|
impl From<ErrorKind> for Error {
|
||||||
|
@ -70,16 +80,6 @@ impl std::error::Error for Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Error {
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
pub fn get_ref(&self) -> Option<&(dyn std::error::Error + Send + Sync + 'static)> {
|
|
||||||
self.error.as_deref()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
|
||||||
pub fn get_ref(&self) -> Option<&(dyn Debug + Send + Sync + 'static)> { self.error.as_deref() }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl From<std::io::Error> for Error {
|
impl From<std::io::Error> for Error {
|
||||||
fn from(o: std::io::Error) -> Error {
|
fn from(o: std::io::Error) -> Error {
|
||||||
|
|
Loading…
Reference in New Issue