src/tools/disks/zpool_status.rs: remove unnecessary checks

Thos things can never happen, so simply use unwrap().
This commit is contained in:
Dietmar Maurer 2020-06-19 18:27:39 +02:00
parent 07fb504943
commit 5d88c3a1c8
1 changed files with 2 additions and 4 deletions

View File

@ -215,8 +215,7 @@ where
// if required, go back up (possibly multiple levels): // if required, go back up (possibly multiple levels):
while vdev_level < cur_level { while vdev_level < cur_level {
children_of_parent.push(Value::Object(cur_node)); children_of_parent.push(Value::Object(cur_node));
let mut prev = // could be better with rust issue #372 resolved... let mut prev = stack.pop().unwrap();
stack.pop().ok_or_else(|| format_err!("broken item list: stack underrun"))?;
prev.0.insert("children".to_string(), Value::Array(children_of_parent)); prev.0.insert("children".to_string(), Value::Array(children_of_parent));
prev.0.insert("leaf".to_string(), Value::Bool(false)); prev.0.insert("leaf".to_string(), Value::Bool(false));
cur_node = prev.0; cur_node = prev.0;
@ -246,8 +245,7 @@ where
while !stack.is_empty() { while !stack.is_empty() {
children_of_parent.push(Value::Object(cur_node)); children_of_parent.push(Value::Object(cur_node));
let mut prev = // could be better with rust issue #372 resolved... let mut prev = stack.pop().unwrap();
stack.pop().ok_or_else(|| format_err!("broken item list: stack underrun"))?;
prev.0.insert("children".to_string(), Value::Array(children_of_parent)); prev.0.insert("children".to_string(), Value::Array(children_of_parent));
if !stack.is_empty() { if !stack.is_empty() {
prev.0.insert("leaf".to_string(), Value::Bool(false)); prev.0.insert("leaf".to_string(), Value::Bool(false));