Replace unwrap() with map()
This commit is contained in:
parent
b6ce57418e
commit
97fde8cc1b
1 changed files with 6 additions and 4 deletions
|
@ -62,10 +62,12 @@ pub fn trace_error_dbg(e: &Error) {
|
|||
/// processed.
|
||||
fn print_trace_maxdepth(idx: u64, e: &Error, max: u64) -> Option<&Error> {
|
||||
if e.cause().is_some() && idx > 0 {
|
||||
match print_trace_maxdepth(idx - 1, e.cause().unwrap(), max) {
|
||||
e.cause().map(|cause| {
|
||||
match print_trace_maxdepth(idx - 1, cause, max) {
|
||||
None => write!(stderr(), "\n").ok(),
|
||||
Some(_) => write!(stderr(), " -- caused:\n").ok(),
|
||||
};
|
||||
});
|
||||
} else {
|
||||
write!(stderr(), "\n").ok();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue