chore(deps): Replace `humantime` with `jiff`
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Shun Sakai · committed by Shun Sakai · parent a4fdad6 · Browse files · 5 files·+57 added−17 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+57 added−17 removed
- tests:+5 added−1 removed
- other:+52 added−16 removed
Provenance
- Commit
c670a0b- Tree
2e628ad- Author
Shun Sakai <sorairolake@protonmail.ch>- Committer
Shun Sakai <sorairolake@protonmail.ch>- Parent
a4fdad6
5 files changed+57 added−17 removed
modified:src/filter/time.rs+4 added-2 removed
1 use chrono::{DateTime, Local, NaiveDate, NaiveDateTime};2+use jiff::Span;3 3-use std::time::SystemTime;4+use std::time::{Duration, SystemTime};5 6 /// Filter based on time ranges.7 #[derive(Debug, PartialEq, Eq)]8 pub enum TimeFilter {2 unmodified lines11 }12 13 impl TimeFilter {14 fn from_str(ref_time: &SystemTime, s: &str) -> Option<SystemTime> {14- humantime::parse_duration(s)15+ s.parse::<Span>()16+ .and_then(Duration::try_from)17 .map(|duration| *ref_time - duration)18 .ok()19 .or_else(|| {20 DateTime::parse_from_rfc3339(s)146 unmodified linesmodified:tests/tests.rs+5 added-1 removed
6 unmodified lines7 use std::path::Path;8 use std::time::{Duration, SystemTime};9 use test_case::test_case;10 11+use jiff::Timestamp;12 use normpath::PathExt;13 use regex::escape;14 15 use crate::testenv::TestEnv;2272 unmodified lines2288 }2289 2290 #[cfg(test)]2291 fn change_file_modified<P: AsRef<Path>>(path: P, iso_date: &str) {2291- let st = humantime::parse_rfc3339(iso_date).expect("invalid date");2292+ let st = iso_date2293+ .parse::<Timestamp>()2294+ .map(SystemTime::from)2295+ .expect("invalid date");2296 let ft = filetime::FileTime::from_system_time(st);2297 filetime::set_file_times(path, ft, ft).expect("time modification failde");2298 }2299 395 unmodified linesmodified:Cargo.lock+46 added-13 removed
324 unmodified lines325 "etcetera",326 "faccess",327 "filetime",328 "globset",329- "humantime",329 "ignore",330 "jemallocator",331+ "jiff",332 "libc",333 "lscolors",334 "nix 0.29.0",335 "normpath",57 unmodified lines393 "windows-sys 0.52.0",394 ]395 396 [[package]]397-name = "humantime"398-version = "2.1.0"399-source = "registry+https://github.com/rust-lang/crates.io-index"400-checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"401-402-[[package]]397 name = "iana-time-zone"398 version = "0.1.60"399 source = "registry+https://github.com/rust-lang/crates.io-index"400 checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"57 unmodified lines458 "libc",459 ]460 461 [[package]]462+name = "jiff"463+version = "0.2.4"464+source = "registry+https://github.com/rust-lang/crates.io-index"465+checksum = "d699bc6dfc879fb1bf9bdff0d4c56f0884fc6f0d0eb0fba397a6d00cd9a6b85e"466+dependencies = [467+ "jiff-static",468+ "log",469+ "portable-atomic",470+ "portable-atomic-util",471+ "serde",472+]473+474+[[package]]475+name = "jiff-static"476+version = "0.2.4"477+source = "registry+https://github.com/rust-lang/crates.io-index"478+checksum = "8d16e75759ee0aa64c57a56acbf43916987b20c77373cb7e808979e02b93c9f9"479+dependencies = [480+ "proc-macro2",481+ "quote",482+ "syn",483+]484+485+[[package]]486 name = "js-sys"487 version = "0.3.70"488 source = "registry+https://github.com/rust-lang/crates.io-index"489 checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"108 unmodified lines598 source = "registry+https://github.com/rust-lang/crates.io-index"599 checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"600 601 [[package]]602+name = "portable-atomic"603+version = "1.11.0"604+source = "registry+https://github.com/rust-lang/crates.io-index"605+checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"606+607+[[package]]608+name = "portable-atomic-util"609+version = "0.2.4"610+source = "registry+https://github.com/rust-lang/crates.io-index"611+checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"612+dependencies = [613+ "portable-atomic",614+]615+616+[[package]]617 name = "proc-macro2"585-version = "1.0.86"618+version = "1.0.94"619 source = "registry+https://github.com/rust-lang/crates.io-index"587-checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"620+checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"621 dependencies = [622 "unicode-ident",623 ]624 625 [[package]]626 name = "quote"594-version = "1.0.36"627+version = "1.0.40"628 source = "registry+https://github.com/rust-lang/crates.io-index"596-checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"629+checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"630 dependencies = [631 "proc-macro2",632 ]633 90 unmodified lines724 checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"725 726 [[package]]727 name = "syn"695-version = "2.0.75"728+version = "2.0.100"729 source = "registry+https://github.com/rust-lang/crates.io-index"697-checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9"730+checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"731 dependencies = [732 "proc-macro2",733 "quote",734 "unicode-ident",281 unmodified linesmodified:Cargo.toml+1 added-1 removed
39 unmodified lines404142434444454647484950515253545539 unmodified lines39 unmodified linesignore = "0.4.23"regex = "1.11.1"regex-syntax = "0.8"ctrlc = "3.2"humantime = "2.1"globset = "0.4"anyhow = "1.0"etcetera = "0.9"normpath = "1.1.1"crossbeam-channel = "0.5.14"clap_complete = {version = "4.5.44", optional = true}faccess = "0.2.4"jiff = { version = "0.2.4", default-features = false, features = ["std"] }
[dependencies.clap]version = "4.5.31"features = ["suggestions", "color", "wrap_help", "cargo", "derive"]39 unmodified linesmodified:CHANGELOG.md+1 added
8 unmodified lines9 10 11 ## Changes12 13+- Replace `humantime` crate with `jiff` crate, see #1690 (@sorairolake)14 15 ## Other16 17 788 unmodified lines