iq: Remove a bunch of clones.
This commit is contained in:
parent
65469db1e3
commit
6df3c4a679
1 changed files with 8 additions and 8 deletions
16
src/iq.rs
16
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."));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue