From 2531b4ac0d28843470bd364a86b846519431e429 Mon Sep 17 00:00:00 2001 From: mos Date: Sun, 28 Jul 2024 09:08:28 +0200 Subject: [PATCH] improve data hashmap retrieval handling --- bip/src/bp.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bip/src/bp.rs b/bip/src/bp.rs index f21bce0..48cb464 100644 --- a/bip/src/bp.rs +++ b/bip/src/bp.rs @@ -158,10 +158,7 @@ impl Writer { fn parse_id(&mut self, node: &Node) -> Result<()> { if let NodeOp::Id(id) = &node.op { - let data_rec = match self.data.get(id) { - Some(rec) => rec, - None => return Err(Error::NotDefined), - }; + let data_rec = self.data.get(id).ok_or(Error::NotDefined)?; let data = Node::new( node.op.clone(),