From 1ce8145a7d4d5ed8bfdb54dc85f5fcb7dadca56f Mon Sep 17 00:00:00 2001 From: "xmppftw@kl.netlib.re" Date: Thu, 18 Jan 2024 15:18:33 +0100 Subject: [PATCH] Fix unused variable warnings when avatars disabled --- xmpp/src/event.rs | 4 +++- xmpp/src/pubsub/mod.rs | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xmpp/src/event.rs b/xmpp/src/event.rs index 46156dca..c7a8e3a2 100644 --- a/xmpp/src/event.rs +++ b/xmpp/src/event.rs @@ -4,7 +4,9 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -use tokio_xmpp::parsers::{bookmarks2, message::Body, roster::Item as RosterItem, BareJid, Jid}; +#[cfg(feature = "avatars")] +use tokio_xmpp::parsers::Jid; +use tokio_xmpp::parsers::{bookmarks2, message::Body, roster::Item as RosterItem, BareJid}; use crate::{delay::StanzaTimeInfo, Error, Id, RoomNick}; diff --git a/xmpp/src/pubsub/mod.rs b/xmpp/src/pubsub/mod.rs index 1c3cea43..921966dd 100644 --- a/xmpp/src/pubsub/mod.rs +++ b/xmpp/src/pubsub/mod.rs @@ -22,9 +22,9 @@ use tokio_xmpp::{ pub(crate) mod avatar; pub(crate) async fn handle_event( - from: &Jid, + #[cfg_attr(not(feature = "avatars"), allow(unused_variables))] from: &Jid, elem: Element, - agent: &mut Agent, + #[cfg_attr(not(feature = "avatars"), allow(unused_variables))] agent: &mut Agent, ) -> Vec { let mut events = Vec::new(); let event = PubSubEvent::try_from(elem); @@ -87,7 +87,10 @@ pub(crate) async fn handle_event( events } -pub(crate) fn handle_iq_result(from: &Jid, elem: Element) -> impl IntoIterator { +pub(crate) fn handle_iq_result( + #[cfg_attr(not(feature = "avatars"), allow(unused_variables))] from: &Jid, + elem: Element, +) -> impl IntoIterator { let mut events = Vec::new(); let pubsub = PubSub::try_from(elem).unwrap(); trace!("PubSub: {:#?}", pubsub);