diff options
| author | bit-aloo <sshourya17@gmail.com> | 2025-07-11 20:36:13 +0530 |
|---|---|---|
| committer | bit-aloo <sshourya17@gmail.com> | 2025-07-11 21:37:38 +0530 |
| commit | d004abb4d3d7a4c50c54ffb3c4f227ff0d689f03 (patch) | |
| tree | 76f5f4fc505b0dabc554031e581b91dbb7ba3baa | |
| parent | cdbe44d8069d2f352c6dea560574a6fa9d9df5ae (diff) | |
| download | rust-d004abb4d3d7a4c50c54ffb3c4f227ff0d689f03.tar.gz rust-d004abb4d3d7a4c50c54ffb3c4f227ff0d689f03.zip | |
remove format short command and push format short command method inside fingerprint impl
| -rw-r--r-- | src/bootstrap/src/utils/exec.rs | 29 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/tracing.rs | 2 |
2 files changed, 4 insertions, 27 deletions
diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs index c5bafda88c4..ebc18f11a05 100644 --- a/src/bootstrap/src/utils/exec.rs +++ b/src/bootstrap/src/utils/exec.rs @@ -76,8 +76,10 @@ pub struct CommandFingerprint { cwd: Option<PathBuf>, } -impl FormatShortCmd for CommandFingerprint { - fn format_short_cmd(&self) -> String { +impl CommandFingerprint { + /// Helper method to format both Command and BootstrapCommand as a short execution line, + /// without all the other details (e.g. environment variables). + pub fn format_short_cmd(&self) -> String { let program = Path::new(&self.program); let mut line = vec![program.file_name().unwrap().to_str().unwrap().to_owned()]; line.extend(self.args.iter().map(|arg| arg.to_string_lossy().into_owned())); @@ -545,29 +547,6 @@ impl Default for CommandOutput { } } -/// Helper trait to format both Command and BootstrapCommand as a short execution line, -/// without all the other details (e.g. environment variables). -pub trait FormatShortCmd { - fn format_short_cmd(&self) -> String; -} - -#[cfg(feature = "tracing")] -impl FormatShortCmd for BootstrapCommand { - fn format_short_cmd(&self) -> String { - self.command.format_short_cmd() - } -} - -#[cfg(feature = "tracing")] -impl FormatShortCmd for Command { - fn format_short_cmd(&self) -> String { - let program = Path::new(self.get_program()); - let mut line = vec![program.file_name().unwrap().to_str().unwrap()]; - line.extend(self.get_args().map(|arg| arg.to_str().unwrap())); - line.join(" ") - } -} - #[derive(Clone, Default)] pub struct ExecutionContext { dry_run: DryRun, diff --git a/src/bootstrap/src/utils/tracing.rs b/src/bootstrap/src/utils/tracing.rs index 58d127dfb79..109407bc5f2 100644 --- a/src/bootstrap/src/utils/tracing.rs +++ b/src/bootstrap/src/utils/tracing.rs @@ -52,8 +52,6 @@ macro_rules! error { macro_rules! trace_cmd { ($cmd:expr) => { { - use $crate::utils::exec::FormatShortCmd; - ::tracing::span!( target: "COMMAND", ::tracing::Level::TRACE, |
