From 053ea863e024087a3f3675610e8ba3baa65c0f10 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 2 Jan 2019 21:05:27 -0500 Subject: [PATCH] clippy: Action::Publish(QueueMsg box contenst --- ofborg/src/notifyworker.rs | 8 ++++---- ofborg/src/worker.rs | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ofborg/src/notifyworker.rs b/ofborg/src/notifyworker.rs index a4626e3..801df26 100644 --- a/ofborg/src/notifyworker.rs +++ b/ofborg/src/notifyworker.rs @@ -72,11 +72,11 @@ impl<'a> NotificationReceiver for ChannelNotificationReceiver<'a> { .basic_nack(self.delivery_tag, false, false) .unwrap(); } - Action::Publish(msg) => { - let exch = msg.exchange.clone().unwrap_or_else(|| "".to_owned()); - let key = msg.routing_key.clone().unwrap_or_else(|| "".to_owned()); + Action::Publish(mut msg) => { + let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned()); + let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned()); - let props = msg.properties.unwrap_or(BasicProperties { + let props = msg.properties.take().unwrap_or(BasicProperties { ..Default::default() }); self.channel diff --git a/ofborg/src/worker.rs b/ofborg/src/worker.rs index 4ed2b8f..eb75f61 100644 --- a/ofborg/src/worker.rs +++ b/ofborg/src/worker.rs @@ -18,7 +18,7 @@ pub enum Action { Ack, NackRequeue, NackDump, - Publish(QueueMsg), + Publish(Box), } #[derive(Debug, PartialEq)] @@ -44,14 +44,14 @@ where ..Default::default() }; - Action::Publish(QueueMsg { + Action::Publish(Box::new(QueueMsg { exchange, routing_key, mandatory: false, immediate: false, properties: Some(props), content: serde_json::to_string(&msg).unwrap().into_bytes(), - }) + })) } pub trait SimpleWorker: Send + 'static { @@ -102,11 +102,11 @@ impl Consumer for Worker { .basic_nack(method.delivery_tag, false, false) .unwrap(); } - Action::Publish(msg) => { - let exch = msg.exchange.clone().unwrap_or_else(|| "".to_owned()); - let key = msg.routing_key.clone().unwrap_or_else(|| "".to_owned()); + Action::Publish(mut msg) => { + let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned()); + let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned()); - let props = msg.properties.unwrap_or(BasicProperties { + let props = msg.properties.take().unwrap_or(BasicProperties { ..Default::default() }); channel