From 6df3c4a679b5a939c6eae740bde4533d57859b14 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 19 May 2017 00:07:51 +0100 Subject: [PATCH] iq: Remove a bunch of clones. --- src/iq.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/iq.rs b/src/iq.rs index 13efbaac..f040b1bd 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -116,31 +116,31 @@ impl<'a> TryFrom<&'a Element> for Iq { return Err(Error::ParseError("Wrong number of children in iq element.")); } } else { - payload = Some(elem); + payload = Some(elem.clone()); } } let type_ = if type_ == "get" { - if let Some(payload) = payload.clone() { - IqType::Get(payload.clone()) + if let Some(payload) = payload { + IqType::Get(payload) } else { return Err(Error::ParseError("Wrong number of children in iq element.")); } } else if type_ == "set" { - if let Some(payload) = payload.clone() { - IqType::Set(payload.clone()) + if let Some(payload) = payload { + IqType::Set(payload) } else { return Err(Error::ParseError("Wrong number of children in iq element.")); } } else if type_ == "result" { - if let Some(payload) = payload.clone() { - IqType::Result(Some(payload.clone())) + if let Some(payload) = payload { + IqType::Result(Some(payload)) } else { IqType::Result(None) } } else if type_ == "error" { if let Some(payload) = error_payload.clone() { - IqType::Error(payload.clone()) + IqType::Error(payload) } else { return Err(Error::ParseError("Wrong number of children in iq element.")); }