diff --git a/src/activitystream/node.rs b/src/activitystream/node.rs index 23149b27..05cf7c1b 100644 --- a/src/activitystream/node.rs +++ b/src/activitystream/node.rs @@ -15,17 +15,14 @@ impl From> for Node { } impl Node { - pub fn get(&self) -> Option<&T> { + pub fn get(self) -> Option { match self { Node::Empty | Node::Link(_) => None, - Node::Object(x) => Some(x), - Node::Array(v) => match v.iter().find_map(|x| match x { - Node::Object(x) => Some(x), + Node::Object(x) => Some(*x), + Node::Array(v) => v.into_iter().find_map(|x| match x { + Node::Object(x) => Some(*x), _ => None, - }) { - Some(x) => Some(x), - None => None, - }, + }), } }