Skip to content

Commit bc586bd

Browse files
Fix clippy warnings project-wide
Signed-off-by: Sergio Correia <[email protected]>
1 parent 9be983a commit bc586bd

File tree

11 files changed

+83
-139
lines changed

11 files changed

+83
-139
lines changed

keylime-push-model-agent/src/attestation.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl AttestationClient {
125125

126126
let req = filler.get_attestation_request();
127127
if let Ok(json_str) = serde_json::to_string(&req) {
128-
debug!("Request body: {}", json_str);
128+
debug!("Request body: {json_str}");
129129
}
130130

131131
let request_builder = self.client.get_json_request_from_struct(
@@ -182,7 +182,7 @@ impl AttestationClient {
182182
&headers,
183183
Some(config.url),
184184
) {
185-
warn!("201 Created response validation failed: {}", e);
185+
warn!("201 Created response validation failed: {e}");
186186
// Don't fail the request, just log the warning for now
187187
}
188188
}
@@ -505,8 +505,7 @@ mod tests {
505505
location.starts_with("http://")
506506
|| location.starts_with("https://")
507507
|| location.starts_with("/"),
508-
"Location header should be a valid URI reference: {}",
509-
location
508+
"Location header should be a valid URI reference: {location}"
510509
);
511510

512511
// Test evidence submission with RFC-compliant Location header
@@ -554,8 +553,7 @@ mod tests {
554553
// Evidence submission failure is acceptable for this test
555554
// We're primarily testing RFC compliance validation
556555
info!(
557-
"Evidence submission failed (expected with mock): {}",
558-
e
556+
"Evidence submission failed (expected with mock): {e}"
559557
);
560558
}
561559
}

keylime-push-model-agent/src/header_validation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ impl std::fmt::Display for HeaderValidationError {
2525
write!(f, "Missing Location header in 201 Created response")
2626
}
2727
HeaderValidationError::InvalidLocationHeader(msg) => {
28-
write!(f, "Invalid Location header value: {}", msg)
28+
write!(f, "Invalid Location header value: {msg}")
2929
}
3030
HeaderValidationError::InvalidBaseUrl(msg) => {
31-
write!(f, "Invalid base URL: {}", msg)
31+
write!(f, "Invalid base URL: {msg}")
3232
}
3333
}
3434
}
@@ -55,7 +55,7 @@ impl HeaderValidator {
5555
)
5656
})?;
5757

58-
debug!("Validating Location header: {}", location_str);
58+
debug!("Validating Location header: {location_str}");
5959

6060
// Use the existing resolve_url function for all URL validation and resolution
6161
if let Some(base_url) = expected_base_url {

keylime-push-model-agent/src/main.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ fn create_registrar_tls_config<T: PushModelConfigTrait>(
116116
let client_key = config.registrar_tls_client_key();
117117

118118
info!("Registrar TLS enabled: true");
119-
debug!("Registrar CA certificate: {}", ca_cert);
120-
debug!("Registrar client certificate: {}", client_cert);
121-
debug!("Registrar client key: {}", client_key);
119+
debug!("Registrar CA certificate: {ca_cert}");
120+
debug!("Registrar client certificate: {client_cert}");
121+
debug!("Registrar client key: {client_key}");
122122

123123
// Only use TLS if all certificate paths are provided
124124
if !ca_cert.is_empty()
@@ -147,8 +147,7 @@ fn create_registrar_tls_config<T: PushModelConfigTrait>(
147147

148148
if provided_count > 0 {
149149
warn!(
150-
"Registrar TLS is enabled but only {} out of 3 certificate paths are configured.",
151-
provided_count
150+
"Registrar TLS is enabled but only {provided_count} out of 3 certificate paths are configured."
152151
);
153152
warn!("This may indicate a configuration mistake.");
154153
warn!(
@@ -327,7 +326,7 @@ async fn main() -> Result<()> {
327326

328327
if let Some(user_group) = run_as {
329328
if let Err(e) = keylime::permissions::run_as(user_group) {
330-
error!("Failed to drop privileges to {}: {}", user_group, e);
329+
error!("Failed to drop privileges to {user_group}: {e}");
331330
error!("Troubleshooting steps:");
332331

333332
// Provide error-specific guidance based on the error type
@@ -364,7 +363,7 @@ async fn main() -> Result<()> {
364363
"Privilege dropping failed. See error messages above for troubleshooting."
365364
));
366365
}
367-
info!("Running the service as {}...", user_group);
366+
info!("Running the service as {user_group}...");
368367
}
369368

370369
// === CONTINUE AS UNPRIVILEGED USER ===

keylime-push-model-agent/src/struct_filler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const MUTEX_POISONED_RECOVERY_MESSAGES: &[&str] = &[
4747
/// Helper function to log mutex poisoning recovery messages
4848
fn log_mutex_poisoning_recovery() {
4949
for msg in MUTEX_POISONED_RECOVERY_MESSAGES {
50-
error!("{}", msg);
50+
error!("{msg}");
5151
}
5252
}
5353

0 commit comments

Comments
 (0)