From e54cd98a9cf31934773331f00acaec30bba2b4c7 Mon Sep 17 00:00:00 2001 From: Jonathan Rothberg Date: Wed, 2 Oct 2019 20:41:53 -0700 Subject: [PATCH] Put code into None case of last match. --- src/commands/get.rs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/commands/get.rs b/src/commands/get.rs index 3b9f578e2..afa550c72 100644 --- a/src/commands/get.rs +++ b/src/commands/get.rs @@ -73,21 +73,20 @@ fn get_member(path: &Tagged, obj: &Tagged) -> Result current = Some(obj), - Tagged { - item: Value::Primitive(Primitive::Path(_)), - .. - } => current = Some(obj), - _ => {} - }; - match current { Some(v) => Ok(v.clone()), - None => Ok(Value::nothing().tagged(obj.tag)), + None => match obj { + // If its None check for certain values. + Tagged { + item: Value::Primitive(Primitive::String(_)), + .. + } => Ok(obj.clone()), + Tagged { + item: Value::Primitive(Primitive::Path(_)), + .. + } => Ok(obj.clone()), + _ => Ok(Value::nothing().tagged(obj.tag)), + }, } }