Skip to content

Commit 4322ce5

Browse files
committed
chore(deps): Replace humantime dependency for jiff
1 parent fbcd538 commit 4322ce5

File tree

4 files changed

+61
-35
lines changed

4 files changed

+61
-35
lines changed

Cargo.lock

+49-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/trycmd/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ rayon = "1.5.1"
5555

5656
serde = { version = "1.0", features = ["derive"] }
5757
shlex = "1.1.0"
58-
humantime = "2"
59-
humantime-serde = "1"
58+
jiff = { version = "0.2.4", default-features = false, features = ["serde"]}
6059
toml_edit = { version = "0.22.13", features = ["serde"] }
6160
escargot = { version = "0.5.13", optional = true }
6261

crates/trycmd/src/runner.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::eprintln;
1111
#[cfg(not(feature = "color"))]
1212
use std::io::stderr;
1313

14+
use jiff::SignedDuration;
1415
use rayon::prelude::*;
1516
use snapbox::data::DataFormat;
1617
use snapbox::dir::FileType;
@@ -68,10 +69,11 @@ impl Runner {
6869
status.spawn.status.summary(),
6970
);
7071
if let Some(duration) = status.duration {
72+
let duration = SignedDuration::try_from(duration).unwrap();
7173
let _ = write!(
7274
stderr,
7375
" {}",
74-
palette.hint(humantime::format_duration(duration)),
76+
palette.hint(format!("{duration:#}")),
7577
);
7678
}
7779
let _ = writeln!(stderr);
@@ -90,10 +92,11 @@ impl Runner {
9092
palette.error("failed"),
9193
);
9294
if let Some(duration) = status.duration {
95+
let duration = SignedDuration::try_from(duration).unwrap();
9396
let _ = write!(
9497
stderr,
9598
" {}",
96-
palette.hint(humantime::format_duration(duration)),
99+
palette.hint(format!("{duration:#}")),
97100
);
98101
}
99102
let _ = writeln!(stderr);

crates/trycmd/src/schema.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ impl From<OneShot> for TryCmd {
559559
expected_stderr_source: None,
560560
expected_stderr: stderr.map(crate::Data::text),
561561
binary,
562-
timeout,
562+
timeout: timeout.map(|e| e.unsigned_abs()),
563563
}],
564564
fs,
565565
}
@@ -645,8 +645,11 @@ pub struct OneShot {
645645
#[serde(default)]
646646
pub(crate) binary: bool,
647647
#[serde(default)]
648-
#[serde(deserialize_with = "humantime_serde::deserialize")]
649-
pub(crate) timeout: Option<std::time::Duration>,
648+
#[cfg_attr(
649+
feature = "unstable-schema",
650+
schemars(with = "Option<std::time::Duration>")
651+
)]
652+
pub(crate) timeout: Option<jiff::SignedDuration>,
650653
#[serde(default)]
651654
pub(crate) fs: Filesystem,
652655
}

0 commit comments

Comments
 (0)