Skip to content

Commit

Permalink
Merge pull request #462 from AnderEnder/remove-deprecated-error-descr…
Browse files Browse the repository at this point in the history
…iption

Remove deprecated Error::description
  • Loading branch information
philipc committed Dec 22, 2019
2 parents 8728e82 + f078597 commit 9630b74
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
16 changes: 5 additions & 11 deletions examples/dwarf-validate.rs
Expand Up @@ -6,7 +6,6 @@ use object::Object;
use rayon::prelude::*;
use std::borrow::{Borrow, Cow};
use std::env;
use std::error;
use std::fs;
use std::io::{self, BufWriter, Write};
use std::iter::Iterator;
Expand Down Expand Up @@ -48,11 +47,7 @@ fn main() {
let file = match fs::File::open(&path) {
Ok(file) => file,
Err(err) => {
eprintln!(
"Failed to open file '{}': {}",
path.display(),
error::Error::description(&err)
);
eprintln!("Failed to open file '{}': {}", path.display(), err);
errors += 1;
continue;
}
Expand Down Expand Up @@ -150,8 +145,7 @@ fn validate_info<W, R>(
Err(err) => {
w.error(format!(
"Can't read unit header at offset {:#x}, stopping reading units: {}",
last_offset,
error::Error::description(&err)
last_offset, err
));
break;
}
Expand All @@ -174,7 +168,7 @@ fn validate_info<W, R>(
w.error(format!(
"Invalid abbrevs for unit {:#x}: {}",
unit.offset().0,
error::Error::description(&err)
&err
));
return ret;
}
Expand All @@ -187,7 +181,7 @@ fn validate_info<W, R>(
w.error(format!(
"Invalid DIE for unit {:#x}: {}",
unit.offset().0,
error::Error::description(&err)
&err
));
return ret;
}
Expand All @@ -204,7 +198,7 @@ fn validate_info<W, R>(
"Invalid attribute for unit {:#x} at DIE {:#x}: {}",
unit.offset().0,
entry.offset().0,
error::Error::description(&err)
&err
));
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/read/dwarf.rs
Expand Up @@ -459,7 +459,7 @@ impl<R: Reader> Dwarf<R> {
Some((sup, section, offset)) => {
return format!(
"{} at {}{}+0x{:x}",
err.description(),
err,
section.name(),
if sup { "(sup)" } else { "" },
offset.into_u64(),
Expand Down
8 changes: 2 additions & 6 deletions src/read/mod.rs
Expand Up @@ -384,7 +384,7 @@ pub enum Error {
impl fmt::Display for Error {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> ::core::result::Result<(), fmt::Error> {
Debug::fmt(self, f)
write!(f, "{}", self.description())
}
}

Expand Down Expand Up @@ -527,11 +527,7 @@ impl Error {
}

#[cfg(feature = "std")]
impl error::Error for Error {
fn description(&self) -> &str {
Error::description(self)
}
}
impl error::Error for Error {}

#[cfg(feature = "std")]
impl From<io::Error> for Error {
Expand Down

0 comments on commit 9630b74

Please sign in to comment.