Skip to content

Commit d004abb

Browse files
committed
remove format short command and push format short command method inside fingerprint impl
1 parent cdbe44d commit d004abb

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
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: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ 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,

0 commit comments

Comments
 (0)