Use check_self!() where it makes sense.

This commit is contained in:
Emmanuel Gil Peyrot 2018-05-12 18:31:11 +02:00
commit 6bb466eea2
12 changed files with 62 additions and 95 deletions

View file

@ -62,9 +62,7 @@ impl TryFrom<Element> for StanzaError {
type Err = Error;
fn try_from(elem: Element) -> Result<StanzaError, Error> {
if !elem.is("error", ns::DEFAULT_NS) {
return Err(Error::ParseError("This is not an error element."));
}
check_self!(elem, "error", ns::DEFAULT_NS);
let type_ = get_attr!(elem, "type", required);
let by = get_attr!(elem, "by", optional);