Skip to content

Commit 185257a

Browse files
Refactoring; introduce cluster definition diffing
1 parent bd84ec9 commit 185257a

File tree

10 files changed

+885
-138
lines changed

10 files changed

+885
-138
lines changed

src/commons.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl From<BindingDestinationType> for String {
534534
}
535535
}
536536

537-
#[derive(Eq, PartialEq, Debug, Deserialize, Serialize, Clone)]
537+
#[derive(Eq, PartialEq, Debug, Deserialize, Serialize, Clone, Copy)]
538538
#[serde(rename_all = "snake_case")]
539539
pub enum PolicyTarget {
540540
Queues,
@@ -614,7 +614,7 @@ impl PolicyTarget {
614614

615615
impl fmt::Display for PolicyTarget {
616616
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
617-
write!(f, "{}", Into::<String>::into(self.clone()))?;
617+
write!(f, "{}", Into::<String>::into(*self))?;
618618

619619
Ok(())
620620
}

src/requests/federation.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use crate::commons::{ChannelUseMode, MessageTransferAcknowledgementMode, QueueType};
1616
use crate::requests::parameters::RuntimeParameterDefinition;
17+
use crate::responses::FederationUpstream;
1718
use serde::{Deserialize, Serialize};
1819
use serde_json::{Map, json};
1920
use std::fmt::{Display, Formatter, Result};
@@ -288,8 +289,8 @@ pub struct OwnedExchangeFederationParams {
288289
pub resource_cleanup_mode: FederationResourceCleanupMode,
289290
}
290291

291-
impl From<crate::responses::FederationUpstream> for OwnedFederationUpstreamParams {
292-
fn from(upstream: crate::responses::FederationUpstream) -> Self {
292+
impl From<FederationUpstream> for OwnedFederationUpstreamParams {
293+
fn from(upstream: FederationUpstream) -> Self {
293294
// Create queue federation parameters if queue-related fields are present
294295
let queue_federation = if upstream.queue.is_some() || upstream.consumer_tag.is_some() {
295296
Some(OwnedQueueFederationParams {

src/requests/policies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'a> From<&'a Policy> for PolicyParams<'a> {
4747
vhost: &policy.vhost,
4848
name: &policy.name,
4949
pattern: &policy.pattern,
50-
apply_to: policy.apply_to.clone(),
50+
apply_to: policy.apply_to,
5151
priority: policy.priority as i32,
5252
definition: policy.definition.clone().into(),
5353
}

0 commit comments

Comments
 (0)