Skip to content

Commit

Permalink
apk-inspect: Pass error by reference to format_error_message()
Browse files Browse the repository at this point in the history
Suggested by clippy.
  • Loading branch information
jirutka committed Aug 2, 2023
1 parent 66634c6 commit c6245fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apk-inspect/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn main() {
}

if let Err(e) = run(args) {
eprintln!("{}", format_error_message(e));
eprintln!("{}", format_error_message(&*e));
exit(1);
}
}
Expand Down Expand Up @@ -159,10 +159,10 @@ fn dump_json<T: ?Sized + serde::Serialize>(
}
}

fn format_error_message(error: Box<dyn error::Error>) -> String {
fn format_error_message(error: &dyn error::Error) -> String {
let mut msg = String::from(PROG_NAME);

let mut source = Some(error.as_ref());
let mut source = Some(error);
while let Some(e) = source {
msg.push_str(": ");
msg.push_str(&e.to_string());
Expand Down

0 comments on commit c6245fa

Please sign in to comment.