clippy: Action::Publish(QueueMsg box contenst

This commit is contained in:
Graham Christensen 2019-01-02 21:05:27 -05:00
parent 63fcd856da
commit 053ea863e0
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
2 changed files with 11 additions and 11 deletions

View file

@ -72,11 +72,11 @@ impl<'a> NotificationReceiver for ChannelNotificationReceiver<'a> {
.basic_nack(self.delivery_tag, false, false) .basic_nack(self.delivery_tag, false, false)
.unwrap(); .unwrap();
} }
Action::Publish(msg) => { Action::Publish(mut msg) => {
let exch = msg.exchange.clone().unwrap_or_else(|| "".to_owned()); let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned());
let key = msg.routing_key.clone().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() ..Default::default()
}); });
self.channel self.channel

View file

@ -18,7 +18,7 @@ pub enum Action {
Ack, Ack,
NackRequeue, NackRequeue,
NackDump, NackDump,
Publish(QueueMsg), Publish(Box<QueueMsg>),
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -44,14 +44,14 @@ where
..Default::default() ..Default::default()
}; };
Action::Publish(QueueMsg { Action::Publish(Box::new(QueueMsg {
exchange, exchange,
routing_key, routing_key,
mandatory: false, mandatory: false,
immediate: false, immediate: false,
properties: Some(props), properties: Some(props),
content: serde_json::to_string(&msg).unwrap().into_bytes(), content: serde_json::to_string(&msg).unwrap().into_bytes(),
}) }))
} }
pub trait SimpleWorker: Send + 'static { pub trait SimpleWorker: Send + 'static {
@ -102,11 +102,11 @@ impl<T: SimpleWorker + Send> Consumer for Worker<T> {
.basic_nack(method.delivery_tag, false, false) .basic_nack(method.delivery_tag, false, false)
.unwrap(); .unwrap();
} }
Action::Publish(msg) => { Action::Publish(mut msg) => {
let exch = msg.exchange.clone().unwrap_or_else(|| "".to_owned()); let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned());
let key = msg.routing_key.clone().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() ..Default::default()
}); });
channel channel