From 5d88c3a1c8dce67800d9941c3d6fed1d8eda5d9d Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 19 Jun 2020 18:27:39 +0200 Subject: [PATCH] src/tools/disks/zpool_status.rs: remove unnecessary checks Thos things can never happen, so simply use unwrap(). --- src/tools/disks/zpool_status.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tools/disks/zpool_status.rs b/src/tools/disks/zpool_status.rs index 4351ca60..009e48ec 100644 --- a/src/tools/disks/zpool_status.rs +++ b/src/tools/disks/zpool_status.rs @@ -215,8 +215,7 @@ where // if required, go back up (possibly multiple levels): while vdev_level < cur_level { children_of_parent.push(Value::Object(cur_node)); - let mut prev = // could be better with rust issue #372 resolved... - stack.pop().ok_or_else(|| format_err!("broken item list: stack underrun"))?; + let mut prev = stack.pop().unwrap(); prev.0.insert("children".to_string(), Value::Array(children_of_parent)); prev.0.insert("leaf".to_string(), Value::Bool(false)); cur_node = prev.0; @@ -246,8 +245,7 @@ where while !stack.is_empty() { children_of_parent.push(Value::Object(cur_node)); - let mut prev = // could be better with rust issue #372 resolved... - stack.pop().ok_or_else(|| format_err!("broken item list: stack underrun"))?; + let mut prev = stack.pop().unwrap(); prev.0.insert("children".to_string(), Value::Array(children_of_parent)); if !stack.is_empty() { prev.0.insert("leaf".to_string(), Value::Bool(false));