Use ref to avoid 'cannot bind by-mode pattern'
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
a55d420979
commit
ae764477c7
1 changed files with 9 additions and 9 deletions
|
@ -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<I
|
|||
if let PubSub::Items(items) = pubsub {
|
||||
match items.node.0.clone() {
|
||||
#[cfg(feature = "avatars")]
|
||||
node if node == ns::AVATAR_DATA => {
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue