Skip to content

Commit 157bd89

Browse files
authored
Unrolled build for #143798
Rollup merge of #143798 - Shourya742:2025-07-11-remove-format-short-command-trait, r=Kobzol Remove format short command trait Since we no longer have traces of the vanilla command, and we're already implementing format_short_command for CommandFingerprint, we can use it directly from the fingerprint. This PR removes the standalone format_short_command trait and moves its implementation under CommandFingerprint.
2 parents d2baa49 + d004abb commit 157bd89

File tree

2 files changed

+5
-28
lines changed

2 files changed

+5
-28
lines changed

src/bootstrap/src/utils/exec.rs

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ pub struct CommandFingerprint {
7676
cwd: Option<PathBuf>,
7777
}
7878

79-
impl FormatShortCmd for CommandFingerprint {
80-
fn format_short_cmd(&self) -> String {
79+
impl CommandFingerprint {
80+
/// Helper method to format both Command and BootstrapCommand as a short execution line,
81+
/// without all the other details (e.g. environment variables).
82+
pub fn format_short_cmd(&self) -> String {
8183
let program = Path::new(&self.program);
8284
let mut line = vec![program.file_name().unwrap().to_str().unwrap().to_owned()];
8385
line.extend(self.args.iter().map(|arg| arg.to_string_lossy().into_owned()));
@@ -545,29 +547,6 @@ impl Default for CommandOutput {
545547
}
546548
}
547549

548-
/// Helper trait to format both Command and BootstrapCommand as a short execution line,
549-
/// without all the other details (e.g. environment variables).
550-
pub trait FormatShortCmd {
551-
fn format_short_cmd(&self) -> String;
552-
}
553-
554-
#[cfg(feature = "tracing")]
555-
impl FormatShortCmd for BootstrapCommand {
556-
fn format_short_cmd(&self) -> String {
557-
self.command.format_short_cmd()
558-
}
559-
}
560-
561-
#[cfg(feature = "tracing")]
562-
impl FormatShortCmd for Command {
563-
fn format_short_cmd(&self) -> String {
564-
let program = Path::new(self.get_program());
565-
let mut line = vec![program.file_name().unwrap().to_str().unwrap()];
566-
line.extend(self.get_args().map(|arg| arg.to_str().unwrap()));
567-
line.join(" ")
568-
}
569-
}
570-
571550
#[derive(Clone, Default)]
572551
pub struct ExecutionContext {
573552
dry_run: DryRun,

src/bootstrap/src/utils/tracing.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,11 @@ macro_rules! error {
5252
macro_rules! trace_cmd {
5353
($cmd:expr) => {
5454
{
55-
use $crate::utils::exec::FormatShortCmd;
56-
5755
::tracing::span!(
5856
target: "COMMAND",
5957
::tracing::Level::TRACE,
6058
"executing command",
61-
cmd = $cmd.format_short_cmd(),
59+
cmd = $cmd.fingerprint().format_short_cmd(),
6260
full_cmd = ?$cmd
6361
).entered()
6462
}

0 commit comments

Comments
 (0)