Fix std::error::Error::description deprecation
This commit is contained in:
parent
587ec66592
commit
cd6c9d972b
@ -111,6 +111,8 @@ impl Into<c_int> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl error::Error for Error {}
|
||||||
|
|
||||||
impl From<Error> for io::Error {
|
impl From<Error> for io::Error {
|
||||||
fn from(value: Error) -> io::Error {
|
fn from(value: Error) -> io::Error {
|
||||||
io::Error::new(io::ErrorKind::Other, value)
|
io::Error::new(io::ErrorKind::Other, value)
|
||||||
@ -119,7 +121,9 @@ impl From<Error> for io::Error {
|
|||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
f.write_str(error::Error::description(self))
|
f.write_str(unsafe {
|
||||||
|
from_utf8_unchecked(CStr::from_ptr(STRINGS[index(self)].as_ptr()).to_bytes())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,9 +315,3 @@ pub fn register_all() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl error::Error for Error {
|
|
||||||
fn description(&self) -> &str {
|
|
||||||
unsafe { from_utf8_unchecked(CStr::from_ptr(STRINGS[index(self)].as_ptr()).to_bytes()) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -932,7 +932,7 @@ impl fmt::Display for ParsePixelError {
|
|||||||
impl error::Error for ParsePixelError {
|
impl error::Error for ParsePixelError {
|
||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
match *self {
|
match *self {
|
||||||
ParsePixelError::NulError(ref e) => e.description(),
|
ParsePixelError::NulError(ref e) => &e.to_string(),
|
||||||
ParsePixelError::UnknownFormat => "unknown pixel format",
|
ParsePixelError::UnknownFormat => "unknown pixel format",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user