Fix tracing debug representation of steps without arguments in bootstrap

This commit is contained in:
Jakub Beránek 2025-08-15 16:52:30 +02:00
parent 8800ec1665
commit e9ce9ff498
No known key found for this signature in database
GPG key ID: 909CD0D26483516B

View file

@ -1839,9 +1839,14 @@ pub fn pretty_step_name<S: Step>() -> String {
/// Renders `step` using its `Debug` implementation and extract the field arguments out of it.
fn step_debug_args<S: Step>(step: &S) -> String {
let step_dbg_repr = format!("{step:?}");
let brace_start = step_dbg_repr.find('{').unwrap_or(0);
let brace_end = step_dbg_repr.rfind('}').unwrap_or(step_dbg_repr.len());
step_dbg_repr[brace_start + 1..brace_end - 1].trim().to_string()
// Some steps do not have any arguments, so they do not have the braces
match (step_dbg_repr.find('{'), step_dbg_repr.rfind('}')) {
(Some(brace_start), Some(brace_end)) => {
step_dbg_repr[brace_start + 1..brace_end - 1].trim().to_string()
}
_ => String::new(),
}
}
fn pretty_print_step<S: Step>(step: &S) -> String {