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."));
|
return Err(Error::ParseError("Wrong number of children in iq element."));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
payload = Some(elem);
|
payload = Some(elem.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let type_ = if type_ == "get" {
|
let type_ = if type_ == "get" {
|
||||||
if let Some(payload) = payload.clone() {
|
if let Some(payload) = payload {
|
||||||
IqType::Get(payload.clone())
|
IqType::Get(payload)
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::ParseError("Wrong number of children in iq element."));
|
return Err(Error::ParseError("Wrong number of children in iq element."));
|
||||||
}
|
}
|
||||||
} else if type_ == "set" {
|
} else if type_ == "set" {
|
||||||
if let Some(payload) = payload.clone() {
|
if let Some(payload) = payload {
|
||||||
IqType::Set(payload.clone())
|
IqType::Set(payload)
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::ParseError("Wrong number of children in iq element."));
|
return Err(Error::ParseError("Wrong number of children in iq element."));
|
||||||
}
|
}
|
||||||
} else if type_ == "result" {
|
} else if type_ == "result" {
|
||||||
if let Some(payload) = payload.clone() {
|
if let Some(payload) = payload {
|
||||||
IqType::Result(Some(payload.clone()))
|
IqType::Result(Some(payload))
|
||||||
} else {
|
} else {
|
||||||
IqType::Result(None)
|
IqType::Result(None)
|
||||||
}
|
}
|
||||||
} else if type_ == "error" {
|
} else if type_ == "error" {
|
||||||
if let Some(payload) = error_payload.clone() {
|
if let Some(payload) = error_payload.clone() {
|
||||||
IqType::Error(payload.clone())
|
IqType::Error(payload)
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::ParseError("Wrong number of children in iq element."));
|
return Err(Error::ParseError("Wrong number of children in iq element."));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue