Skip to content

Commit bbfcebb

Browse files
author
developerworks
committed
Fix all clippy::uninlined_format_args errors across 11 source files
- Inline all format arguments in format!() calls to use {var} syntax instead of passing variables as arguments - Fixes clippy::uninlined_format_args (denied via -D warnings) detected by Rust 1.88 clippy on CI
1 parent b8f60f8 commit bbfcebb

11 files changed

Lines changed: 49 additions & 29 deletions

File tree

src/config/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl ConfigState {
327327
use std::hash::{Hash, Hasher};
328328
let mut hasher = std::collections::hash_map::DefaultHasher::new();
329329
json.hash(&mut hasher);
330-
format!("v{:x}", hasher.finish())
330+
format!("v{hash:x}", hash = hasher.finish())
331331
}
332332

333333
/// Recovers pending transactions after a restart.

src/dashboard/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl DashboardError {
6868
"unsupported_method",
6969
"protocol_parse",
7070
None,
71-
format!("unsupported dashboard IPC method {}", method.as_ref()),
71+
format!("unsupported dashboard IPC method {m}", m = method.as_ref()),
7272
false,
7373
)
7474
}
@@ -182,7 +182,7 @@ impl DashboardError {
182182
"authz_denied",
183183
"authorization",
184184
None,
185-
format!("command {} is not authorized", method.into()),
185+
format!("command {m} is not authorized", m = method.into()),
186186
false,
187187
)
188188
}
@@ -204,7 +204,7 @@ impl DashboardError {
204204
"replay_detected",
205205
"replay_protection",
206206
None,
207-
format!("replay detected for request_id {}", request_id.into()),
207+
format!("replay detected for request_id {r}", r = request_id.into()),
208208
false,
209209
)
210210
}
@@ -253,7 +253,7 @@ impl DashboardError {
253253
"allowlist_denied",
254254
"allowlist",
255255
None,
256-
format!("external command not in allowlist: {}", path.into()),
256+
format!("external command not in allowlist: {p}", p = path.into()),
257257
false,
258258
)
259259
}

src/dashboard/ipc_server.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,10 @@ pub fn validate_command(command: &ControlCommandRequest) -> Result<(), Dashboard
839839
return Err(DashboardError::validation(
840840
"command_validate",
841841
Some(command.target_id.clone()),
842-
format!("command_id is not a valid UUID: {}", command.command_id),
842+
format!(
843+
"command_id is not a valid UUID: {id}",
844+
id = command.command_id
845+
),
843846
));
844847
}
845848
// AddChild requires a non-empty manifest.

src/dashboard/registration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub async fn send_registration_upsert(
178178
"registration_ack_read_timeout",
179179
"registration_send",
180180
Some(config.target_id.clone()),
181-
format!("timed out reading registration ack after {}s", io_timeout,),
181+
format!("timed out reading registration ack after {io_timeout}s"),
182182
true,
183183
)
184184
})?

src/dashboard/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl BoundedFrameReader {
316316
"frame_too_large",
317317
"ipc_read",
318318
None,
319-
format!("frame exceeded maximum size of {} bytes", self.max_bytes),
319+
format!("frame exceeded maximum size of {max} bytes", max = self.max_bytes),
320320
false,
321321
));
322322
}

src/dashboard/state.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ pub fn build_dashboard_state(
5757
);
5858
let recent_logs = recent_events
5959
.iter()
60-
.map(|event| log_record_for_event(event, format!("event {}", event.event_type)))
60+
.map(|event| {
61+
log_record_for_event(
62+
event,
63+
format!("event {event_type}", event_type = event.event_type),
64+
)
65+
})
6166
.collect::<Vec<_>>();
6267
DashboardState {
6368
target: TargetProcessIdentity {
@@ -160,8 +165,8 @@ pub fn runtime_state_rows(state: &SupervisorState) -> Vec<RuntimeState> {
160165
.map(|child| RuntimeState {
161166
child_path: child.path.to_string(),
162167
lifecycle_state: child.state.as_label().to_owned(),
163-
health: format!("{:?}", child.health).to_lowercase(),
164-
readiness: format!("{:?}", child.readiness).to_lowercase(),
168+
health: format!("{health:?}", health = child.health).to_lowercase(),
169+
readiness: format!("{readiness:?}", readiness = child.readiness).to_lowercase(),
165170
generation: child.generation.value,
166171
child_start_count: child.child_start_count.value,
167172
restart_count: child.restart_count,
@@ -173,7 +178,7 @@ pub fn runtime_state_rows(state: &SupervisorState) -> Vec<RuntimeState> {
173178
.last_policy_decision
174179
.as_ref()
175180
.map(|decision| decision.decision.clone()),
176-
shutdown_state: format!("{:?}", state.shutdown_state).to_lowercase(),
181+
shutdown_state: format!("{s:?}", s = state.shutdown_state).to_lowercase(),
177182
})
178183
.collect()
179184
}

src/ipc/security/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ impl IpcSecurityPipeline {
296296
if !self.audit_config.enabled {
297297
return Ok(());
298298
}
299-
let hash = format!("uid:{}:pid:{}", peer_identity.uid, peer_identity.pid);
299+
let hash = format!(
300+
"uid:{uid}:pid:{pid}",
301+
uid = peer_identity.uid,
302+
pid = peer_identity.pid
303+
);
300304
let now = std::time::SystemTime::now()
301305
.duration_since(std::time::UNIX_EPOCH)
302306
.unwrap_or_default()

src/observe/pipeline.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ fn make_backpressure_alert(
472472
) -> SupervisorEvent {
473473
let mut ev = event.clone();
474474
ev.what = What::BackpressureAlert {
475-
subscriber: format!("subscriber_{}", subscriber_index),
475+
subscriber: format!("subscriber_{subscriber_index}"),
476476
buffer_pct: occupancy_pct,
477477
threshold_pct,
478478
};
@@ -493,7 +493,7 @@ fn make_backpressure_degradation(
493493
BackpressureStrategy::SampleAndAudit => "sample_and_audit",
494494
};
495495
ev.what = What::BackpressureDegradation {
496-
subscriber: format!("subscriber_{}", subscriber_index),
496+
subscriber: format!("subscriber_{subscriber_index}"),
497497
strategy: strategy_name.to_owned(),
498498
sample_ratio: FiniteF64::new(0.5),
499499
buffer_peak_pct: occupancy_pct,
@@ -1200,7 +1200,7 @@ fn merge_generation_fence_child_control_audit_fields(
12001200
if let Some(fence) = &outcome.generation_fence {
12011201
context.insert(
12021202
"generation_fence_decision".to_owned(),
1203-
format!("{:?}", fence.decision),
1203+
format!("{decision:?}", decision = fence.decision),
12041204
);
12051205
context.insert(
12061206
"generation_fence_abort_requested".to_owned(),
@@ -1283,19 +1283,19 @@ fn audit_child_control(input: ChildControlAuditInput<'_>) -> AuditRecord {
12831283
context.insert("status".to_owned(), optional_debug(input.outcome.status));
12841284
context.insert(
12851285
"operation_before".to_owned(),
1286-
format!("{:?}", input.outcome.operation_before),
1286+
format!("{ob:?}", ob = input.outcome.operation_before),
12871287
);
12881288
context.insert(
12891289
"operation_after".to_owned(),
1290-
format!("{:?}", input.outcome.operation_after),
1290+
format!("{oa:?}", oa = input.outcome.operation_after),
12911291
);
12921292
context.insert(
12931293
"cancel_delivered".to_owned(),
12941294
input.outcome.cancel_delivered.to_string(),
12951295
);
12961296
context.insert(
12971297
"stop_state".to_owned(),
1298-
format!("{:?}", input.outcome.stop_state),
1298+
format!("{ss:?}", ss = input.outcome.stop_state),
12991299
);
13001300
context.insert(
13011301
"restart_limit_remaining".to_owned(),

src/runtime/control_loop.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ impl RuntimeControlState {
700700
// Execute six-stage supervision pipeline for failure processing.
701701
let sequence = self.event_sequences.next().value;
702702
// T037: Generate a real CorrelationId to link budget→meltdown→escalation events.
703-
let correlation_id_str = format!("{}", uuid::Uuid::new_v4());
703+
let correlation_id_str = uuid::Uuid::new_v4().to_string();
704704
let supervisor_path = self
705705
.slots
706706
.get(&child_id)
@@ -748,7 +748,7 @@ impl RuntimeControlState {
748748
)
749749
&& let Some(ref group_id) = pipeline_result.group_id
750750
{
751-
let _ignored = event_sender.send(format!("group_fuse_active:{group_id}:{}", child_id));
751+
let _ignored = event_sender.send(format!("group_fuse_active:{group_id}:{child_id}"));
752752
// Mark all children in the affected group as non-restartable.
753753
for (_cid, slot) in self.slots.iter_mut() {
754754
if slot.group.as_deref() == Some(group_id.as_str()) {
@@ -1045,7 +1045,7 @@ impl RuntimeControlState {
10451045
&mut self.orphan_count,
10461046
) {
10471047
let _ =
1048-
event_sender.send(format!("child_orphaned:{}:shutdown_phase=reconcile", diag,));
1048+
event_sender.send(format!("child_orphaned:{diag}:shutdown_phase=reconcile"));
10491049
}
10501050
}
10511051
let reconcile = ShutdownReconcileReport::core_runtime_completed();
@@ -1069,7 +1069,10 @@ impl RuntimeControlState {
10691069
reconcile,
10701070
idempotent: false,
10711071
};
1072-
let _ignored = event_sender.send(format!("shutdown_completed:{}", report.outcomes.len()));
1072+
let _ignored = event_sender.send(format!(
1073+
"shutdown_completed:{len}",
1074+
len = report.outcomes.len()
1075+
));
10731076
self.shutdown_pipeline.cache_report(report.clone());
10741077

10751078
// Step 4: active orphan degradation detection.
@@ -3034,7 +3037,10 @@ impl RuntimeControlState {
30343037
idempotent: false,
30353038
};
30363039
self.shutdown_pipeline.cache_report(report.clone());
3037-
let _ignored = event_sender.send(format!("shutdown_completed:{}", report.outcomes.len()));
3040+
let _ignored = event_sender.send(format!(
3041+
"shutdown_completed:{len}",
3042+
len = report.outcomes.len()
3043+
));
30383044

30393045
// Step 4: active orphan degradation detection.
30403046
let threshold = self.shutdown.policy.effective_max_orphan_threshold() as u64;
@@ -3480,7 +3486,10 @@ pub async fn run_control_loop(
34803486
Ok(()) => {
34813487
let report = RuntimeExitReport::completed(
34823488
"shutdown",
3483-
format!("runtime control plane shutdown requested: {}", meta.reason),
3489+
format!(
3490+
"runtime control plane shutdown requested: {reason}",
3491+
reason = meta.reason
3492+
),
34843493
);
34853494
let _ignored = reply_sender.send(Ok(report.clone()));
34863495
return report;

src/runtime/pipeline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,9 @@ impl SupervisionPipeline {
747747
let fuse_outcome_str = ctx
748748
.budget_evaluation
749749
.as_ref()
750-
.map(|be| format!("{:?}", be.meltdown_outcome));
750+
.map(|be| format!("{mo:?}", mo = be.meltdown_outcome));
751751
return What::EscalationBifurcated {
752-
severity: format!("{:?}", policy.severity),
752+
severity: format!("{s:?}", s = policy.severity),
753753
budget_verdict: budget_verdict_str,
754754
fuse_outcome: fuse_outcome_str,
755755
tie_break_reason: None,

0 commit comments

Comments
 (0)