From ae764477c7b35237c0b85272fc9f1f74ac7520be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 23 Oct 2019 00:46:26 +0200 Subject: [PATCH] Use ref to avoid 'cannot bind by-mode pattern' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- xmpp-rs/src/pubsub/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xmpp-rs/src/pubsub/mod.rs b/xmpp-rs/src/pubsub/mod.rs index 896858c1..c4736563 100644 --- a/xmpp-rs/src/pubsub/mod.rs +++ b/xmpp-rs/src/pubsub/mod.rs @@ -32,11 +32,11 @@ pub(crate) fn handle_event(from: &Jid, elem: Element, mut tx: &mut mpsc::Unbound Ok(PubSubEvent::PublishedItems { node, items }) => { match node.0 { #[cfg(feature = "avatars")] - node if node == ns::AVATAR_METADATA => { + ref node if node == ns::AVATAR_METADATA => { let new_events = avatar::handle_metadata_pubsub_event(&from, &mut tx, items); events.extend(new_events); }, - node if node == ns::BOOKMARKS2 => { + ref node if node == ns::BOOKMARKS2 => { // TODO: Check that our bare JID is the sender. assert_eq!(items.len(), 1); let item = items.clone().pop().unwrap(); @@ -53,28 +53,28 @@ pub(crate) fn handle_event(from: &Jid, elem: Element, mut tx: &mut mpsc::Unbound Err(err) => println!("not bookmark: {}", err) } }, - node => unimplemented!("node {}", node) + ref node => unimplemented!("node {}", node) } } Ok(PubSubEvent::RetractedItems { node, items }) => { match node.0 { - node if node == ns::BOOKMARKS2 => { + ref node if node == ns::BOOKMARKS2 => { // TODO: Check that our bare JID is the sender. assert_eq!(items.len(), 1); let item = items.clone().pop().unwrap(); let jid = BareJid::from_str(&item.0).unwrap(); events.push(Event::LeaveRoom(jid)); }, - node => unimplemented!("node {}", node) + ref node => unimplemented!("node {}", node) } } Ok(PubSubEvent::Purge { node }) => { match node.0 { - node if node == ns::BOOKMARKS2 => { + ref node if node == ns::BOOKMARKS2 => { // TODO: Check that our bare JID is the sender. events.push(Event::LeaveAllRooms); }, - node => unimplemented!("node {}", node) + ref node => unimplemented!("node {}", node) } } _ => unimplemented!() @@ -89,11 +89,11 @@ pub(crate) fn handle_iq_result(from: &Jid, elem: Element) -> impl IntoIterator { + ref node if node == ns::AVATAR_DATA => { let new_events = avatar::handle_data_pubsub_iq(&from, &items); events.extend(new_events); }, - node if node == ns::BOOKMARKS2 => { + ref node if node == ns::BOOKMARKS2 => { events.push(Event::LeaveAllRooms); for item in items.items { let item = item.0;