Skip to content

Commit

Permalink
Delete unused tuple fields
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Jan 6, 2024
1 parent 711e05a commit 9bc3b0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/print/fuchsia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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) {
Expand Down
15 changes: 5 additions & 10 deletions tests/current-exe-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) => {
Expand All @@ -34,7 +34,7 @@ const VAR: &str = "__THE_TEST_YOU_ARE_LUKE";

#[derive(Debug)]
enum EarlyExit {
IgnoreTest(String),
IgnoreTest,
IoError(std::io::Error),
}

Expand All @@ -47,7 +47,7 @@ impl From<std::io::Error> 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();
Expand Down Expand Up @@ -111,7 +111,7 @@ fn find_interpreter(me: &Path) -> Result<PathBuf, EarlyExit> {
.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() {
Expand All @@ -124,11 +124,6 @@ fn find_interpreter(me: &Path) -> Result<PathBuf, EarlyExit> {
}
}
}

Err(EarlyExit::IgnoreTest(
"could not find interpreter from readelf output".into(),
))
} else {
Err(EarlyExit::IgnoreTest("readelf returned non-success".into()))
}
Err(EarlyExit::IgnoreTest)
}

0 comments on commit 9bc3b0d

Please sign in to comment.