Skip to content

Commit aae633d

Browse files
committed
Make clippy happy
1 parent f28c79f commit aae633d

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

src/commands.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub fn list_policies_in_and_applying_to(
129129
let policies = client.list_policies_in(vhost)?;
130130
Ok(policies
131131
.into_iter()
132-
.filter(|pol| apply_to.does_apply_to(pol.apply_to.clone()))
132+
.filter(|pol| apply_to.does_apply_to(pol.apply_to))
133133
.collect())
134134
}
135135

@@ -139,10 +139,10 @@ pub fn list_matching_policies_in(
139139
name: &str,
140140
typ: PolicyTarget,
141141
) -> ClientResult<Vec<responses::Policy>> {
142-
let candidates = list_policies_in_and_applying_to(client, vhost, typ.clone())?;
142+
let candidates = list_policies_in_and_applying_to(client, vhost, typ)?;
143143
Ok(candidates
144144
.into_iter()
145-
.filter(|pol| pol.does_match_name(vhost, name, typ.clone()))
145+
.filter(|pol| pol.does_match_name(vhost, name, typ))
146146
.collect())
147147
}
148148

@@ -165,7 +165,7 @@ pub fn list_operator_policies_in_and_applying_to(
165165
let policies = client.list_operator_policies_in(vhost)?;
166166
Ok(policies
167167
.into_iter()
168-
.filter(|pol| apply_to.does_apply_to(pol.apply_to.clone()))
168+
.filter(|pol| apply_to.does_apply_to(pol.apply_to))
169169
.collect())
170170
}
171171

@@ -175,10 +175,10 @@ pub fn list_matching_operator_policies_in(
175175
name: &str,
176176
typ: PolicyTarget,
177177
) -> ClientResult<Vec<responses::Policy>> {
178-
let candidates = list_operator_policies_in_and_applying_to(client, vhost, typ.clone())?;
178+
let candidates = list_operator_policies_in_and_applying_to(client, vhost, typ)?;
179179
Ok(candidates
180180
.into_iter()
181-
.filter(|pol| pol.does_match_name(vhost, name, typ.clone()))
181+
.filter(|pol| pol.does_match_name(vhost, name, typ))
182182
.collect())
183183
}
184184

@@ -1578,7 +1578,7 @@ pub fn declare_policy(
15781578
vhost,
15791579
name,
15801580
pattern,
1581-
apply_to: apply_to.clone(),
1581+
apply_to,
15821582
priority: priority.parse::<i32>().unwrap(),
15831583
definition: parsed_definition,
15841584
};
@@ -1606,7 +1606,7 @@ pub fn declare_operator_policy(
16061606
vhost,
16071607
name: &name,
16081608
pattern: &pattern,
1609-
apply_to: apply_to.clone(),
1609+
apply_to,
16101610
priority: priority.parse::<i32>().unwrap(),
16111611
definition: parsed_definition,
16121612
};

src/errors.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,10 @@ fn format_client_error(
144144
status_code: &StatusCode,
145145
error_details: &Option<rabbitmq_http_client::error::ErrorDetails>,
146146
) -> String {
147-
if let Some(details) = error_details {
148-
if let Some(reason) = details.reason() {
147+
if let Some(details) = error_details
148+
&& let Some(reason) = details.reason() {
149149
return reason.to_string();
150150
}
151-
}
152151
format!(
153152
"API responded with a client error: status code of {}",
154153
status_code
@@ -159,14 +158,13 @@ fn format_server_error(
159158
status_code: &StatusCode,
160159
error_details: &Option<rabbitmq_http_client::error::ErrorDetails>,
161160
) -> String {
162-
if let Some(details) = error_details {
163-
if let Some(reason) = details.reason() {
161+
if let Some(details) = error_details
162+
&& let Some(reason) = details.reason() {
164163
return format!(
165164
"API responded with a server error: status code of {}\n\n{}",
166165
status_code, reason
167166
);
168167
}
169-
}
170168
format!(
171169
"API responded with a server error: status code of {}",
172170
status_code

src/tables.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,13 @@ fn generic_failed_request_details(
523523
},
524524
];
525525

526-
if let Some(details) = error_details {
527-
if let Some(reason) = details.reason() {
526+
if let Some(details) = error_details
527+
&& let Some(reason) = details.reason() {
528528
data.push(RowOfTwo {
529529
key: "error",
530530
value: reason,
531531
});
532532
}
533-
}
534533

535534
build_simple_table(data)
536535
}

0 commit comments

Comments
 (0)