Put code into None case of last match.

This commit is contained in:
Jonathan Rothberg 2019-10-02 20:41:53 -07:00
parent f3eb4fb24e
commit e54cd98a9c

View File

@ -73,21 +73,20 @@ fn get_member(path: &Tagged<String>, obj: &Tagged<Value>) -> Result<Tagged<Value
} }
} }
match obj { match current {
Some(v) => Ok(v.clone()),
None => match obj {
// If its None check for certain values.
Tagged { Tagged {
item: Value::Primitive(Primitive::String(_)), item: Value::Primitive(Primitive::String(_)),
.. ..
} => current = Some(obj), } => Ok(obj.clone()),
Tagged { Tagged {
item: Value::Primitive(Primitive::Path(_)), item: Value::Primitive(Primitive::Path(_)),
.. ..
} => current = Some(obj), } => Ok(obj.clone()),
_ => {} _ => Ok(Value::nothing().tagged(obj.tag)),
}; },
match current {
Some(v) => Ok(v.clone()),
None => Ok(Value::nothing().tagged(obj.tag)),
} }
} }