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

@ -189,9 +189,7 @@ impl TryFrom<Element> for Message {
type Err = Error;
fn try_from(root: Element) -> Result<Message, Error> {
if !root.is("message", ns::DEFAULT_NS) {
return Err(Error::ParseError("This is not a message element."));
}
check_self!(root, "message", ns::DEFAULT_NS);
let from = get_attr!(root, "from", optional);
let to = get_attr!(root, "to", optional);
let id = get_attr!(root, "id", optional);