diff --git a/src/print/fuchsia.rs b/src/print/fuchsia.rs index cb872697d..6e0e7ddd0 100644 --- a/src/print/fuchsia.rs +++ b/src/print/fuchsia.rs @@ -336,7 +336,7 @@ fn get_build_id<'a>(info: &'a dl_phdr_info) -> Option<&'a [u8]> { enum Error { /// NameError means that an error occurred while converting a C style string /// into a rust string. - NameError(core::str::Utf8Error), + NameError, /// BuildIDError means that we didn't find a build ID. This could either be /// because the DSO had no build ID or because the segment containing the /// build ID was malformed. @@ -362,8 +362,8 @@ fn for_each_dso(mut visitor: &mut DsoPrinter<'_, '_>) { unsafe { core::slice::from_raw_parts(info.name as *const u8, name_len) }; let name = match core::str::from_utf8(name_slice) { Ok(name) => name, - Err(err) => { - return visitor.error(Error::NameError(err)) as i32; + Err(_) => { + return visitor.error(Error::NameError) as i32; } }; let build_id = match get_build_id(info) { diff --git a/tests/current-exe-mismatch.rs b/tests/current-exe-mismatch.rs index b655827fb..e305b6677 100644 --- a/tests/current-exe-mismatch.rs +++ b/tests/current-exe-mismatch.rs @@ -16,7 +16,7 @@ fn main() { Ok(()) => { println!("test result: ok"); } - Err(EarlyExit::IgnoreTest(_)) => { + Err(EarlyExit::IgnoreTest) => { println!("test result: ignored"); } Err(EarlyExit::IoError(e)) => { @@ -34,7 +34,7 @@ const VAR: &str = "__THE_TEST_YOU_ARE_LUKE"; #[derive(Debug)] enum EarlyExit { - IgnoreTest(String), + IgnoreTest, IoError(std::io::Error), } @@ -47,7 +47,7 @@ impl From for EarlyExit { fn parent() -> Result<(), EarlyExit> { // If we cannot re-exec this test, there's no point in trying to do it. if common::cannot_reexec_the_test() { - return Err(EarlyExit::IgnoreTest("(cannot reexec)".into())); + return Err(EarlyExit::IgnoreTest); } let me = std::env::current_exe().unwrap(); @@ -111,7 +111,7 @@ fn find_interpreter(me: &Path) -> Result { .arg("-l") .arg(me) .output() - .map_err(|_err| EarlyExit::IgnoreTest("readelf invocation failed".into()))?; + .map_err(|_| EarlyExit::IgnoreTest)?; if result.status.success() { let r = BufReader::new(&result.stdout[..]); for line in r.lines() { @@ -124,11 +124,6 @@ fn find_interpreter(me: &Path) -> Result { } } } - - Err(EarlyExit::IgnoreTest( - "could not find interpreter from readelf output".into(), - )) - } else { - Err(EarlyExit::IgnoreTest("readelf returned non-success".into())) } + Err(EarlyExit::IgnoreTest) }