From 62b2966b9dd5e815eda84fd36811fa3f09814dbb Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 24 Jul 2024 21:39:13 +0200 Subject: [PATCH] xmpp-parsers: Simplify the page-flip logic for MAM This only has to be a bool, no need for this Option. --- parsers/src/mam.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parsers/src/mam.rs b/parsers/src/mam.rs index 9482b92a..403008bf 100644 --- a/parsers/src/mam.rs +++ b/parsers/src/mam.rs @@ -53,7 +53,7 @@ impl TryFrom for Query { let mut form = None; let mut set = None; - let mut flip_page = None; + let mut flip_page = false; for child in elem.children() { if child.is("x", ns::DATA_FORMS) { if form.is_some() { @@ -75,13 +75,13 @@ impl TryFrom for Query { continue; } if child.is("flip-page", ns::MAM) { - if flip_page.is_some() { + if flip_page { return Err(Error::Other( "Element query must not have more than one flip-page child.", ) .into()); } - flip_page = Some(true); + flip_page = true; continue; } return Err(Error::Other("Unknown child in query element.").into()); @@ -97,7 +97,7 @@ impl TryFrom for Query { }, form, set, - flip_page: flip_page.is_some(), + flip_page, }) } }