Replace unwrap() with map()
This commit is contained in:
parent
97fde8cc1b
commit
9ea1811e21
1 changed files with 1 additions and 1 deletions
|
@ -77,7 +77,7 @@ fn print_trace_maxdepth(idx: u64, e: &Error, max: u64) -> Option<&Error> {
|
||||||
|
|
||||||
/// Count errors in `Error::cause()` recursively
|
/// Count errors in `Error::cause()` recursively
|
||||||
fn count_error_causes(e: &Error) -> u64 {
|
fn count_error_causes(e: &Error) -> u64 {
|
||||||
1 + if e.cause().is_some() { count_error_causes(e.cause().unwrap()) } else { 0 }
|
1 + e.cause().map(|c| count_error_causes(c)).unwrap_or(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_trace_dbg(idx: u64, e: &Error) {
|
fn print_trace_dbg(idx: u64, e: &Error) {
|
||||||
|
|
Loading…
Reference in a new issue