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.
|
/// processed.
|
||||||
fn print_trace_maxdepth(idx: u64, e: &Error, max: u64) -> Option<&Error> {
|
fn print_trace_maxdepth(idx: u64, e: &Error, max: u64) -> Option<&Error> {
|
||||||
if e.cause().is_some() && idx > 0 {
|
if e.cause().is_some() && idx > 0 {
|
||||||
match print_trace_maxdepth(idx - 1, e.cause().unwrap(), max) {
|
e.cause().map(|cause| {
|
||||||
None => write!(stderr(), "\n").ok(),
|
match print_trace_maxdepth(idx - 1, cause, max) {
|
||||||
Some(_) => write!(stderr(), " -- caused:\n").ok(),
|
None => write!(stderr(), "\n").ok(),
|
||||||
};
|
Some(_) => write!(stderr(), " -- caused:\n").ok(),
|
||||||
|
};
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
write!(stderr(), "\n").ok();
|
write!(stderr(), "\n").ok();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue