diff --git a/.deny.toml b/.deny.toml index f7d2a56ca..7fd592c41 100644 --- a/.deny.toml +++ b/.deny.toml @@ -11,9 +11,6 @@ unmaintained = "warn" yanked = "warn" notice = "warn" ignore = [ - # time 0.1, via chrono. Chrono no longer uses the vulnerable code path, - # and they plan to drop the dependency for the 0.5 release. - "RUSTSEC-2020-0071", # atty: we don't use a custom allocator on Windows, and our deps haven't # updated to alternatives yet "RUSTSEC-2021-0145", diff --git a/.dprint.json b/.dprint.json index f74d7261e..f23774ae9 100644 --- a/.dprint.json +++ b/.dprint.json @@ -15,6 +15,7 @@ }, "includes": ["**/*.{ts,tsx,js,jsx,cjs,mjs,json,md,toml,svelte}"], "excludes": [ + ".vscode", "**/node_modules", "out/**", "**/*-lock.json", diff --git a/Cargo.lock b/Cargo.lock index 9b83d4545..e04deb819 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -407,16 +407,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", - "js-sys", "num-integer", "num-traits", - "time 0.1.45", - "wasm-bindgen", "winapi", ] @@ -764,9 +761,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" +checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf" dependencies = [ "cc", "cxxbridge-flags", @@ -776,9 +773,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" +checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39" dependencies = [ "cc", "codespan-reporting", @@ -791,15 +788,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" +checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12" [[package]] name = "cxxbridge-macro" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" +checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6" dependencies = [ "proc-macro2", "quote", @@ -1711,9 +1708,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.137" +version = "0.2.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" [[package]] name = "libsqlite3-sys" @@ -2041,9 +2038,9 @@ dependencies = [ [[package]] name = "num-format" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec", "itoa 1.0.4", @@ -2474,7 +2471,7 @@ dependencies = [ "indexmap", "line-wrap", "serde", - "time 0.3.17", + "time", "xml-rs", ] @@ -2847,7 +2844,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ "pem", "ring", - "time 0.3.17", + "time", "yasna", ] @@ -3170,9 +3167,9 @@ checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" [[package]] name = "serde" -version = "1.0.148" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" +checksum = "256b9932320c590e707b94576e3cc1f7c9024d0ee6612dfbcf1cb106cbe8e055" dependencies = [ "serde_derive", ] @@ -3190,9 +3187,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.148" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" +checksum = "b4eae9b04cbffdfd550eb462ed33bc6a1b68c935127d008b27444d08380f94e4" dependencies = [ "proc-macro2", "quote", @@ -3391,7 +3388,7 @@ dependencies = [ "slog", "term", "thread_local", - "time 0.3.17", + "time", ] [[package]] @@ -3513,9 +3510,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.104" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce" +checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" dependencies = [ "proc-macro2", "quote", @@ -3631,17 +3628,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.3.17" @@ -3736,9 +3722,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -3879,7 +3865,7 @@ dependencies = [ "log", "p12", "rcgen", - "time 0.3.17", + "time", "tugger-common", "tugger-windows", "yasna", @@ -3896,9 +3882,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unic-char-property" @@ -4112,12 +4098,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -4409,7 +4389,7 @@ dependencies = [ "sha2", "snafu", "syn", - "time 0.3.17", + "time", "time-macros", "tokio", "url", @@ -4449,7 +4429,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "346d34a236c9d3e5f3b9b74563f238f955bbd05fa0b8b4efa53c130c43982f4c" dependencies = [ - "time 0.3.17", + "time", ] [[package]] @@ -4468,7 +4448,7 @@ dependencies = [ "hmac", "pbkdf2", "sha1", - "time 0.3.17", + "time", "zstd 0.11.2+zstd.1.5.2", ] diff --git a/cargo/licenses.json b/cargo/licenses.json index 37275624c..73de9268d 100644 --- a/cargo/licenses.json +++ b/cargo/licenses.json @@ -37,7 +37,7 @@ }, { "name": "aho-corasick", - "version": "0.7.19", + "version": "0.7.20", "authors": "Andrew Gallant ", "repository": "https://github.com/BurntSushi/aho-corasick", "license": "MIT OR Unlicense", @@ -46,7 +46,7 @@ }, { "name": "ammonia", - "version": "3.2.1", + "version": "3.3.0", "authors": "Michael Howell ", "repository": "https://github.com/rust-ammonia/ammonia", "license": "Apache-2.0 OR MIT", @@ -74,7 +74,7 @@ { "name": "anki_i18n", "version": "0.0.0", - "authors": "Ankitects Pty Ltd and contributors", + "authors": "Ankitects Pty Ltd and contributors ", "repository": null, "license": "AGPL-3.0-or-later", "license_file": null, @@ -82,7 +82,7 @@ }, { "name": "anyhow", - "version": "1.0.65", + "version": "1.0.66", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/anyhow", "license": "Apache-2.0 OR MIT", @@ -107,15 +107,6 @@ "license_file": null, "description": "Macros to take array references of slices" }, - { - "name": "arrayvec", - "version": "0.4.12", - "authors": "bluss", - "repository": "https://github.com/bluss/arrayvec", - "license": "Apache-2.0 OR MIT", - "license_file": null, - "description": "A vector with fixed capacity, backed by an array (it can be stored on the stack too). Implements fixed capacity ArrayVec and ArrayString." - }, { "name": "arrayvec", "version": "0.7.2", @@ -127,7 +118,7 @@ }, { "name": "async-trait", - "version": "0.1.57", + "version": "0.1.59", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/async-trait", "license": "Apache-2.0 OR MIT", @@ -163,7 +154,7 @@ }, { "name": "base64", - "version": "0.13.0", + "version": "0.13.1", "authors": "Alice Maz |Marshall Pierce ", "repository": "https://github.com/marshallpierce/rust-base64", "license": "Apache-2.0 OR MIT", @@ -190,7 +181,7 @@ }, { "name": "blake3", - "version": "1.3.1", + "version": "1.3.3", "authors": "Jack O'Connor |Samuel Neves", "repository": "https://github.com/BLAKE3-team/BLAKE3", "license": "Apache-2.0 OR CC0-1.0", @@ -217,7 +208,7 @@ }, { "name": "bumpalo", - "version": "3.11.0", + "version": "3.11.1", "authors": "Nick Fitzgerald ", "repository": "https://github.com/fitzgen/bumpalo", "license": "Apache-2.0 OR MIT", @@ -235,7 +226,7 @@ }, { "name": "bytes", - "version": "1.2.1", + "version": "1.3.0", "authors": "Carl Lerche |Sean McArthur ", "repository": "https://github.com/tokio-rs/bytes", "license": "MIT", @@ -262,9 +253,9 @@ }, { "name": "cc", - "version": "1.0.73", + "version": "1.0.77", "authors": "Alex Crichton ", - "repository": "https://github.com/alexcrichton/cc-rs", + "repository": "https://github.com/rust-lang/cc-rs", "license": "Apache-2.0 OR MIT", "license_file": null, "description": "A build-time dependency for Cargo build scripts to assist in invoking the native C compiler to compile native C code into a static archive to be linked into Rust code." @@ -280,7 +271,7 @@ }, { "name": "chrono", - "version": "0.4.22", + "version": "0.4.23", "authors": null, "repository": "https://github.com/chronotope/chrono", "license": "Apache-2.0 OR MIT", @@ -305,6 +296,15 @@ "license_file": null, "description": "Time and duration crate optimized for speed" }, + { + "name": "codespan-reporting", + "version": "0.11.1", + "authors": "Brendan Zabarauskas ", + "repository": "https://github.com/brendanzab/codespan", + "license": "Apache-2.0", + "license_file": null, + "description": "Beautiful diagnostic reporting for text-based programming languages" + }, { "name": "constant_time_eq", "version": "0.1.5", @@ -314,6 +314,15 @@ "license_file": null, "description": "Compares two equal-sized byte strings in constant time." }, + { + "name": "constant_time_eq", + "version": "0.2.4", + "authors": "Cesar Eduardo Barros ", + "repository": "https://github.com/cesarb/constant_time_eq", + "license": "Apache-2.0 OR CC0-1.0 OR MIT-0", + "license_file": null, + "description": "Compares two equal-sized byte strings in constant time." + }, { "name": "convert_case", "version": "0.6.0", @@ -370,7 +379,7 @@ }, { "name": "crossbeam-utils", - "version": "0.8.11", + "version": "0.8.14", "authors": null, "repository": "https://github.com/crossbeam-rs/crossbeam", "license": "Apache-2.0 OR MIT", @@ -404,14 +413,50 @@ "license_file": null, "description": "Bare bones CSV parsing with no_std support." }, + { + "name": "cxx", + "version": "1.0.83", + "authors": "David Tolnay ", + "repository": "https://github.com/dtolnay/cxx", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Safe interop between Rust and C++" + }, + { + "name": "cxx-build", + "version": "1.0.83", + "authors": "David Tolnay ", + "repository": "https://github.com/dtolnay/cxx", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "C++ code generator for integrating `cxx` crate into a Cargo build." + }, + { + "name": "cxxbridge-flags", + "version": "1.0.83", + "authors": "David Tolnay ", + "repository": "https://github.com/dtolnay/cxx", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Compiler configuration of the `cxx` crate (implementation detail)" + }, + { + "name": "cxxbridge-macro", + "version": "1.0.83", + "authors": "David Tolnay ", + "repository": "https://github.com/dtolnay/cxx", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Implementation detail of the `cxx` crate." + }, { "name": "digest", - "version": "0.10.5", + "version": "0.10.6", "authors": "RustCrypto Developers", "repository": "https://github.com/RustCrypto/traits", "license": "Apache-2.0 OR MIT", "license_file": null, - "description": "Traits for cryptographic hash functions" + "description": "Traits for cryptographic hash functions and message authentication codes" }, { "name": "dirs-next", @@ -431,6 +476,15 @@ "license_file": null, "description": "system-level helper functions for the dirs and directories crates" }, + { + "name": "displaydoc", + "version": "0.2.3", + "authors": "Jane Lusby ", + "repository": "https://github.com/yaahc/displaydoc", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "A derive macro for implementing the display Trait via a doc comment and string interpolation" + }, { "name": "dissimilar", "version": "1.0.4", @@ -469,13 +523,31 @@ }, { "name": "env_logger", - "version": "0.9.1", + "version": "0.10.0", "authors": null, - "repository": "https://github.com/env-logger-rs/env_logger/", + "repository": "https://github.com/rust-cli/env_logger/", "license": "Apache-2.0 OR MIT", "license_file": null, "description": "A logging implementation for `log` which is configured via an environment variable." }, + { + "name": "errno", + "version": "0.2.8", + "authors": "Chris Wong ", + "repository": "https://github.com/lambda-fairy/rust-errno", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Cross-platform interface to the `errno` variable." + }, + { + "name": "errno-dragonfly", + "version": "0.1.2", + "authors": "Michael Neumann ", + "repository": "https://github.com/mneumann/errno-dragonfly-rs", + "license": "MIT", + "license_file": null, + "description": "Exposes errno functionality to stable Rust on DragonFlyBSD" + }, { "name": "fallible-iterator", "version": "0.2.0", @@ -514,7 +586,7 @@ }, { "name": "flate2", - "version": "1.0.24", + "version": "1.0.25", "authors": "Alex Crichton |Josh Triplett ", "repository": "https://github.com/rust-lang/flate2-rs", "license": "Apache-2.0 OR MIT", @@ -604,7 +676,7 @@ }, { "name": "futures", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -613,7 +685,7 @@ }, { "name": "futures-channel", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -622,7 +694,7 @@ }, { "name": "futures-core", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -631,7 +703,7 @@ }, { "name": "futures-executor", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -640,7 +712,7 @@ }, { "name": "futures-io", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -649,7 +721,7 @@ }, { "name": "futures-macro", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -658,7 +730,7 @@ }, { "name": "futures-sink", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -667,7 +739,7 @@ }, { "name": "futures-task", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -676,7 +748,7 @@ }, { "name": "futures-util", - "version": "0.3.24", + "version": "0.3.25", "authors": null, "repository": "https://github.com/rust-lang/futures-rs", "license": "Apache-2.0 OR MIT", @@ -703,7 +775,7 @@ }, { "name": "getrandom", - "version": "0.2.7", + "version": "0.2.8", "authors": "The Rand Project Developers", "repository": "https://github.com/rust-random/getrandom", "license": "Apache-2.0 OR MIT", @@ -721,7 +793,7 @@ }, { "name": "h2", - "version": "0.3.14", + "version": "0.3.15", "authors": "Carl Lerche |Sean McArthur ", "repository": "https://github.com/hyperium/h2", "license": "MIT", @@ -764,6 +836,15 @@ "license_file": null, "description": "hermit-abi is small interface to call functions from the unikernel RustyHermit. It is used to build the target `x86_64-unknown-hermit`." }, + { + "name": "hermit-abi", + "version": "0.2.6", + "authors": "Stefan Lankes", + "repository": "https://github.com/hermitcore/rusty-hermit", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "hermit-abi is small interface to call functions from the unikernel RustyHermit. It is used to build the target `x86_64-unknown-hermit`." + }, { "name": "hex", "version": "0.4.3", @@ -847,7 +928,7 @@ }, { "name": "hyper", - "version": "0.14.20", + "version": "0.14.23", "authors": "Sean McArthur ", "repository": "https://github.com/hyperium/hyper", "license": "MIT", @@ -883,13 +964,22 @@ }, { "name": "iana-time-zone", - "version": "0.1.50", - "authors": "Andrew Straw ", + "version": "0.1.53", + "authors": "Andrew Straw |René Kijewski |Ryan Lopopolo ", "repository": "https://github.com/strawlab/iana-time-zone", "license": "Apache-2.0 OR MIT", "license_file": null, "description": "get the IANA time zone for the current system" }, + { + "name": "iana-time-zone-haiku", + "version": "0.1.1", + "authors": "René Kijewski ", + "repository": "https://github.com/strawlab/iana-time-zone", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "iana-time-zone support crate for Haiku OS" + }, { "name": "id_tree", "version": "1.8.0", @@ -910,7 +1000,7 @@ }, { "name": "indexmap", - "version": "1.9.1", + "version": "1.9.2", "authors": null, "repository": "https://github.com/bluss/indexmap", "license": "Apache-2.0 OR MIT", @@ -946,22 +1036,40 @@ }, { "name": "intl_pluralrules", - "version": "7.0.1", + "version": "7.0.2", "authors": "Kekoa Riggin |Zibi Braniecki ", "repository": "https://github.com/zbraniecki/pluralrules", "license": "Apache-2.0 OR MIT", "license_file": null, "description": "Unicode Plural Rules categorizer for numeric input." }, + { + "name": "io-lifetimes", + "version": "1.0.3", + "authors": "Dan Gohman ", + "repository": "https://github.com/sunfishcode/io-lifetimes", + "license": "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT", + "license_file": null, + "description": "A low-level I/O ownership and borrowing library" + }, { "name": "ipnet", - "version": "2.5.0", + "version": "2.5.1", "authors": "Kris Price ", "repository": "https://github.com/krisprice/ipnet", "license": "Apache-2.0 OR MIT", "license_file": null, "description": "Provides types and useful methods for working with IPv4 and IPv6 network addresses, commonly called IP prefixes. The new `IpNet`, `Ipv4Net`, and `Ipv6Net` types build on the existing `IpAddr`, `Ipv4Addr`, and `Ipv6Addr` types already provided in Rust's standard library and align to their design to stay consistent. The module also provides useful traits that extend `Ipv4Addr` and `Ipv6Addr` with methods for `Add`, `Sub`, `BitAnd`, and `BitOr` operations. The module only uses stable feature so it is guaranteed to compile using the stable toolchain." }, + { + "name": "is-terminal", + "version": "0.4.1", + "authors": "softprops |Dan Gohman ", + "repository": "https://github.com/sunfishcode/is-terminal", + "license": "MIT", + "license_file": null, + "description": "Test whether a given stream is a terminal" + }, { "name": "itertools", "version": "0.10.5", @@ -973,16 +1081,7 @@ }, { "name": "itoa", - "version": "0.4.8", - "authors": "David Tolnay ", - "repository": "https://github.com/dtolnay/itoa", - "license": "Apache-2.0 OR MIT", - "license_file": null, - "description": "Fast functions for printing integer primitives to an io::Write" - }, - { - "name": "itoa", - "version": "1.0.3", + "version": "1.0.4", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/itoa", "license": "Apache-2.0 OR MIT", @@ -1018,7 +1117,7 @@ }, { "name": "libc", - "version": "0.2.133", + "version": "0.2.138", "authors": "The Rust Project Developers", "repository": "https://github.com/rust-lang/libc", "license": "Apache-2.0 OR MIT", @@ -1027,13 +1126,31 @@ }, { "name": "libsqlite3-sys", - "version": "0.25.1", + "version": "0.25.2", "authors": "The rusqlite developers", "repository": "https://github.com/rusqlite/rusqlite", "license": "MIT", "license_file": null, "description": "Native bindings to the libsqlite3 library" }, + { + "name": "link-cplusplus", + "version": "1.0.7", + "authors": "David Tolnay ", + "repository": "https://github.com/dtolnay/link-cplusplus", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Link libstdc++ or libc++ automatically or manually" + }, + { + "name": "linux-raw-sys", + "version": "0.1.3", + "authors": "Dan Gohman ", + "repository": "https://github.com/sunfishcode/linux-raw-sys", + "license": "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT", + "license_file": null, + "description": "Generated bindings for Linux's userspace API" + }, { "name": "lock_api", "version": "0.4.9", @@ -1133,9 +1250,18 @@ "license_file": null, "description": "DEFLATE compression and decompression library rewritten in Rust based on miniz" }, + { + "name": "miniz_oxide", + "version": "0.6.2", + "authors": "Frommi |oyvindln ", + "repository": "https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide", + "license": "Apache-2.0 OR MIT OR Zlib", + "license_file": null, + "description": "DEFLATE compression and decompression library rewritten in Rust based on miniz" + }, { "name": "mio", - "version": "0.8.4", + "version": "0.8.5", "authors": "Carl Lerche |Thomas de Zeeuw |Tokio Contributors ", "repository": "https://github.com/tokio-rs/mio", "license": "MIT", @@ -1153,7 +1279,7 @@ }, { "name": "native-tls", - "version": "0.2.10", + "version": "0.2.11", "authors": "Steven Fackler ", "repository": "https://github.com/sfackler/rust-native-tls", "license": "Apache-2.0 OR MIT", @@ -1169,15 +1295,6 @@ "license_file": null, "description": "panic in debug, intrinsics::unreachable() in release (fork of debug_unreachable)" }, - { - "name": "nodrop", - "version": "0.1.14", - "authors": "bluss", - "repository": "https://github.com/bluss/arrayvec", - "license": "Apache-2.0 OR MIT", - "license_file": null, - "description": "A wrapper type to inhibit drop (destructor). ***Deprecated: Use ManuallyDrop or MaybeUninit instead!***" - }, { "name": "nom", "version": "7.1.1", @@ -1189,7 +1306,7 @@ }, { "name": "num-format", - "version": "0.4.0", + "version": "0.4.4", "authors": "Brian Myers ", "repository": "https://github.com/bcmyers/num-format", "license": "Apache-2.0 OR MIT", @@ -1261,7 +1378,7 @@ }, { "name": "once_cell", - "version": "1.15.0", + "version": "1.16.0", "authors": "Aleksey Kladov ", "repository": "https://github.com/matklad/once_cell", "license": "Apache-2.0 OR MIT", @@ -1279,7 +1396,7 @@ }, { "name": "openssl", - "version": "0.10.41", + "version": "0.10.43", "authors": "Steven Fackler ", "repository": "https://github.com/sfackler/rust-openssl", "license": "Apache-2.0", @@ -1306,7 +1423,7 @@ }, { "name": "openssl-sys", - "version": "0.9.75", + "version": "0.9.78", "authors": "Alex Crichton |Steven Fackler ", "repository": "https://github.com/sfackler/rust-openssl", "license": "MIT", @@ -1324,7 +1441,7 @@ }, { "name": "parking_lot_core", - "version": "0.9.3", + "version": "0.9.5", "authors": "Amanieu d'Antras ", "repository": "https://github.com/Amanieu/parking_lot", "license": "Apache-2.0 OR MIT", @@ -1486,7 +1603,7 @@ }, { "name": "pkg-config", - "version": "0.3.25", + "version": "0.3.26", "authors": "Alex Crichton ", "repository": "https://github.com/rust-lang/pkg-config-rs", "license": "Apache-2.0 OR MIT", @@ -1495,7 +1612,7 @@ }, { "name": "ppv-lite86", - "version": "0.2.16", + "version": "0.2.17", "authors": "The CryptoCorrosion Contributors", "repository": "https://github.com/cryptocorrosion/cryptocorrosion", "license": "Apache-2.0 OR MIT", @@ -1511,6 +1628,15 @@ "license_file": null, "description": "A library intending to be a base dependency to expose a precomputed hash" }, + { + "name": "prettyplease", + "version": "0.1.21", + "authors": "David Tolnay ", + "repository": "https://github.com/dtolnay/prettyplease", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "A minimal `syn` syntax tree pretty-printer" + }, { "name": "proc-macro-crate", "version": "1.2.1", @@ -1531,7 +1657,7 @@ }, { "name": "proc-macro2", - "version": "1.0.43", + "version": "1.0.47", "authors": "David Tolnay |Alex Crichton ", "repository": "https://github.com/dtolnay/proc-macro2", "license": "Apache-2.0 OR MIT", @@ -1540,7 +1666,7 @@ }, { "name": "prost", - "version": "0.11.0", + "version": "0.11.3", "authors": "Dan Burkert |Lucio Franco ", "repository": "https://github.com/tokio-rs/prost", "license": "Apache-2.0", @@ -1549,7 +1675,7 @@ }, { "name": "prost-build", - "version": "0.11.1", + "version": "0.11.3", "authors": "Dan Burkert |Lucio Franco |Tokio Contributors ", "repository": "https://github.com/tokio-rs/prost", "license": "Apache-2.0", @@ -1558,7 +1684,7 @@ }, { "name": "prost-derive", - "version": "0.11.0", + "version": "0.11.2", "authors": "Dan Burkert |Lucio Franco |Tokio Contributors ", "repository": "https://github.com/tokio-rs/prost", "license": "Apache-2.0", @@ -1567,7 +1693,7 @@ }, { "name": "prost-types", - "version": "0.11.1", + "version": "0.11.2", "authors": "Dan Burkert |Lucio Franco ", "repository": "https://github.com/tokio-rs/prost", "license": "Apache-2.0", @@ -1639,7 +1765,7 @@ }, { "name": "regex", - "version": "1.6.0", + "version": "1.7.0", "authors": "The Rust Project Developers", "repository": "https://github.com/rust-lang/regex", "license": "Apache-2.0 OR MIT", @@ -1657,7 +1783,7 @@ }, { "name": "regex-syntax", - "version": "0.6.27", + "version": "0.6.28", "authors": "The Rust Project Developers", "repository": "https://github.com/rust-lang/regex", "license": "Apache-2.0 OR MIT", @@ -1718,6 +1844,15 @@ "license_file": null, "description": "speed, non-cryptographic hash used in rustc" }, + { + "name": "rustix", + "version": "0.36.4", + "authors": "Dan Gohman |Jakub Konka ", + "repository": "https://github.com/bytecodealliance/rustix", + "license": "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT", + "license_file": null, + "description": "Safe Rust bindings to POSIX/Unix/Linux/Winsock2-like syscalls" + }, { "name": "rustls", "version": "0.19.1", @@ -1772,6 +1907,15 @@ "license_file": null, "description": "A RAII scope guard that will run a given closure when it goes out of scope, even if the code between panics (assuming unwinding panic). Defines the macros `defer!`, `defer_on_unwind!`, `defer_on_success!` as shorthands for guards with one of the implemented strategies." }, + { + "name": "scratch", + "version": "1.0.2", + "authors": "David Tolnay ", + "repository": "https://github.com/dtolnay/scratch", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Compile-time temporary directory shared by multiple crates and erased by `cargo clean`" + }, { "name": "sct", "version": "0.6.1", @@ -1810,7 +1954,7 @@ }, { "name": "serde", - "version": "1.0.147", + "version": "1.0.149", "authors": "Erick Tryzelaar |David Tolnay ", "repository": "https://github.com/serde-rs/serde", "license": "Apache-2.0 OR MIT", @@ -1819,7 +1963,7 @@ }, { "name": "serde-aux", - "version": "4.0.0", + "version": "4.1.2", "authors": "Victor Polevoy ", "repository": "https://github.com/vityafx/serde-aux", "license": "MIT", @@ -1828,7 +1972,7 @@ }, { "name": "serde_derive", - "version": "1.0.147", + "version": "1.0.149", "authors": "Erick Tryzelaar |David Tolnay ", "repository": "https://github.com/serde-rs/serde", "license": "Apache-2.0 OR MIT", @@ -1837,7 +1981,7 @@ }, { "name": "serde_json", - "version": "1.0.88", + "version": "1.0.89", "authors": "Erick Tryzelaar |David Tolnay ", "repository": "https://github.com/serde-rs/json", "license": "Apache-2.0 OR MIT", @@ -1880,15 +2024,6 @@ "license_file": null, "description": "`x-www-form-urlencoded` meets Serde" }, - { - "name": "sha1", - "version": "0.6.1", - "authors": "Armin Ronacher ", - "repository": "https://github.com/mitsuhiko/sha1-smol", - "license": "BSD-3-Clause", - "license_file": null, - "description": "Minimal dependency free implementation of SHA1 for Rust." - }, { "name": "sha1", "version": "0.10.5", @@ -1898,15 +2033,6 @@ "license_file": null, "description": "SHA-1 hash function" }, - { - "name": "sha1_smol", - "version": "1.0.0", - "authors": "Armin Ronacher ", - "repository": "https://github.com/mitsuhiko/sha1-smol", - "license": "BSD-3-Clause", - "license_file": null, - "description": "Minimal dependency free implementation of SHA1 for Rust." - }, { "name": "sha2", "version": "0.10.6", @@ -1999,7 +2125,7 @@ }, { "name": "smallvec", - "version": "1.9.0", + "version": "1.10.0", "authors": "The Servo Project Developers", "repository": "https://github.com/servo/rust-smallvec", "license": "Apache-2.0 OR MIT", @@ -2008,7 +2134,7 @@ }, { "name": "snafu", - "version": "0.7.2", + "version": "0.7.3", "authors": "Jake Goulding ", "repository": "https://github.com/shepmaster/snafu", "license": "Apache-2.0 OR MIT", @@ -2017,7 +2143,7 @@ }, { "name": "snafu-derive", - "version": "0.7.2", + "version": "0.7.3", "authors": "Jake Goulding ", "repository": "https://github.com/shepmaster/snafu", "license": "Apache-2.0 OR MIT", @@ -2098,7 +2224,7 @@ }, { "name": "syn", - "version": "1.0.100", + "version": "1.0.105", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/syn", "license": "Apache-2.0 OR MIT", @@ -2152,7 +2278,7 @@ }, { "name": "thiserror", - "version": "1.0.35", + "version": "1.0.37", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/thiserror", "license": "Apache-2.0 OR MIT", @@ -2161,7 +2287,7 @@ }, { "name": "thiserror-impl", - "version": "1.0.35", + "version": "1.0.37", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/thiserror", "license": "Apache-2.0 OR MIT", @@ -2179,16 +2305,7 @@ }, { "name": "time", - "version": "0.1.44", - "authors": "The Rust Project Developers", - "repository": "https://github.com/time-rs/time", - "license": "Apache-2.0 OR MIT", - "license_file": null, - "description": "Utilities for working with time-related functions in Rust." - }, - { - "name": "time", - "version": "0.3.14", + "version": "0.3.17", "authors": "Jacob Pratt |Time contributors", "repository": "https://github.com/time-rs/time", "license": "Apache-2.0 OR MIT", @@ -2196,20 +2313,29 @@ "description": "Date and time library. Fully interoperable with the standard library. Mostly compatible with #![no_std]." }, { - "name": "time-macros", - "version": "0.2.4", + "name": "time-core", + "version": "0.1.0", "authors": "Jacob Pratt |Time contributors", "repository": "https://github.com/time-rs/time", "license": "Apache-2.0 OR MIT", "license_file": null, - "description": "Procedural macros for the time crate." + "description": "This crate is an implementation detail and should not be relied upon directly." + }, + { + "name": "time-macros", + "version": "0.2.6", + "authors": "Jacob Pratt |Time contributors", + "repository": "https://github.com/time-rs/time", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Procedural macros for the time crate. This crate is an implementation detail and should not be relied upon directly." }, { "name": "tinystr", - "version": "0.3.4", - "authors": "Raph Levien |Zibi Braniecki ", - "repository": "https://github.com/zbraniecki/tinystr", - "license": "Apache-2.0 OR MIT", + "version": "0.7.0", + "authors": "The ICU4X Project Developers", + "repository": "https://github.com/unicode-org/icu4x", + "license": "Unicode-DFS-2016", "license_file": null, "description": "A small ASCII-only bounded length string representation." }, @@ -2233,7 +2359,7 @@ }, { "name": "tokio", - "version": "1.21.2", + "version": "1.22.0", "authors": "Tokio Contributors ", "repository": "https://github.com/tokio-rs/tokio", "license": "MIT", @@ -2251,7 +2377,7 @@ }, { "name": "tokio-macros", - "version": "1.8.0", + "version": "1.8.2", "authors": "Tokio Contributors ", "repository": "https://github.com/tokio-rs/tokio", "license": "MIT", @@ -2314,7 +2440,7 @@ }, { "name": "tracing", - "version": "0.1.36", + "version": "0.1.37", "authors": "Eliza Weisman |Tokio Contributors ", "repository": "https://github.com/tokio-rs/tracing", "license": "MIT", @@ -2323,7 +2449,7 @@ }, { "name": "tracing-core", - "version": "0.1.29", + "version": "0.1.30", "authors": "Tokio Contributors ", "repository": "https://github.com/tokio-rs/tracing", "license": "MIT", @@ -2350,7 +2476,7 @@ }, { "name": "typenum", - "version": "1.15.0", + "version": "1.16.0", "authors": "Paho Lurie-Gregg |Andre Bogus ", "repository": "https://github.com/paholg/typenum", "license": "Apache-2.0 OR MIT", @@ -2386,7 +2512,7 @@ }, { "name": "unic-langid", - "version": "0.9.0", + "version": "0.9.1", "authors": "Zibi Braniecki ", "repository": "https://github.com/zbraniecki/unic-locale", "license": "Apache-2.0 OR MIT", @@ -2395,7 +2521,7 @@ }, { "name": "unic-langid-impl", - "version": "0.9.0", + "version": "0.9.1", "authors": "Zibi Braniecki ", "repository": "https://github.com/zbraniecki/unic-locale", "license": "Apache-2.0 OR MIT", @@ -2404,7 +2530,7 @@ }, { "name": "unic-langid-macros", - "version": "0.9.0", + "version": "0.9.1", "authors": "Manish Goregaokar |Zibi Braniecki ", "repository": "https://github.com/zbraniecki/unic-locale", "license": "Apache-2.0 OR MIT", @@ -2413,7 +2539,7 @@ }, { "name": "unic-langid-macros-impl", - "version": "0.9.0", + "version": "0.9.1", "authors": "Manish Goregaokar |Zibi Braniecki ", "repository": "https://github.com/zbraniecki/unic-locale", "license": "Apache-2.0 OR MIT", @@ -2458,7 +2584,7 @@ }, { "name": "unicode-ident", - "version": "1.0.4", + "version": "1.0.5", "authors": "David Tolnay ", "repository": "https://github.com/dtolnay/unicode-ident", "license": "(MIT OR Apache-2.0) AND Unicode-DFS-2016", @@ -2564,15 +2690,6 @@ "license_file": null, "description": "Detect when another Future wants a result." }, - { - "name": "wasi", - "version": "0.10.0+wasi-snapshot-preview1", - "authors": "The Cranelift Project Developers", - "repository": "https://github.com/bytecodealliance/wasi", - "license": "Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT", - "license_file": null, - "description": "Experimental WASI API bindings for Rust" - }, { "name": "wasi", "version": "0.11.0+wasi-snapshot-preview1", @@ -2717,6 +2834,24 @@ "license_file": null, "description": "Rust for Windows" }, + { + "name": "windows-sys", + "version": "0.42.0", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Rust for Windows" + }, + { + "name": "windows_aarch64_gnullvm", + "version": "0.42.0", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Code gen support for the windows crate" + }, { "name": "windows_aarch64_msvc", "version": "0.36.1", @@ -2726,6 +2861,15 @@ "license_file": null, "description": "Code gen support for the windows crate" }, + { + "name": "windows_aarch64_msvc", + "version": "0.42.0", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Code gen support for the windows crate" + }, { "name": "windows_i686_gnu", "version": "0.36.1", @@ -2735,6 +2879,15 @@ "license_file": null, "description": "Code gen support for the windows crate" }, + { + "name": "windows_i686_gnu", + "version": "0.42.0", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Code gen support for the windows crate" + }, { "name": "windows_i686_msvc", "version": "0.36.1", @@ -2744,6 +2897,15 @@ "license_file": null, "description": "Code gen support for the windows crate" }, + { + "name": "windows_i686_msvc", + "version": "0.42.0", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Code gen support for the windows crate" + }, { "name": "windows_x86_64_gnu", "version": "0.36.1", @@ -2753,6 +2915,24 @@ "license_file": null, "description": "Code gen support for the windows crate" }, + { + "name": "windows_x86_64_gnu", + "version": "0.42.0", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Code gen support for the windows crate" + }, + { + "name": "windows_x86_64_gnullvm", + "version": "0.42.0", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Code gen support for the windows crate" + }, { "name": "windows_x86_64_msvc", "version": "0.36.1", @@ -2762,6 +2942,15 @@ "license_file": null, "description": "Code gen support for the windows crate" }, + { + "name": "windows_x86_64_msvc", + "version": "0.42.0", + "authors": "Microsoft", + "repository": "https://github.com/microsoft/windows-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Code gen support for the windows crate" + }, { "name": "winreg", "version": "0.7.0", @@ -2798,6 +2987,15 @@ "license_file": null, "description": "Binding for the zstd compression library." }, + { + "name": "zstd", + "version": "0.12.0+zstd.1.5.2", + "authors": "Alexandre Bury ", + "repository": "https://github.com/gyscos/zstd-rs", + "license": "MIT", + "license_file": null, + "description": "Binding for the zstd compression library." + }, { "name": "zstd-safe", "version": "5.0.2+zstd.1.5.2", @@ -2807,9 +3005,18 @@ "license_file": null, "description": "Safe low-level bindings for the zstd compression library." }, + { + "name": "zstd-safe", + "version": "6.0.2+zstd.1.5.2", + "authors": "Alexandre Bury ", + "repository": "https://github.com/gyscos/zstd-rs", + "license": "Apache-2.0 OR MIT", + "license_file": null, + "description": "Safe low-level bindings for the zstd compression library." + }, { "name": "zstd-sys", - "version": "2.0.1+zstd.1.5.2", + "version": "2.0.4+zstd.1.5.2", "authors": "Alexandre Bury ", "repository": "https://github.com/gyscos/zstd-rs", "license": "Apache-2.0 OR MIT", diff --git a/cargo/update-licenses.sh b/cargo/update-licenses.sh index 7f15adc1d..63a6120aa 100755 --- a/cargo/update-licenses.sh +++ b/cargo/update-licenses.sh @@ -1,3 +1,7 @@ #!/bin/bash -cargo-license --features rustls native-tls --json --manifest-path ../rslib/Cargo.toml > licenses.json +cargo install cargo-license@0.5.1 +cargo-license --features rustls --features native-tls --json --manifest-path ../rslib/Cargo.toml >licenses.json + +cargo install cargo-deny@0.13.5 +(cd .. && cargo deny check -A duplicate) diff --git a/rslib/Cargo.toml b/rslib/Cargo.toml index 683cd3dca..0788b99b5 100644 --- a/rslib/Cargo.toml +++ b/rslib/Cargo.toml @@ -48,15 +48,13 @@ pct-str = { git = "https://github.com/timothee-haudebourg/pct-str.git", rev = "4 # pinned as any changes could invalidate sqlite indexes unicase = "=2.6.0" -# pinned until the deprecation warnings can be addressed -chrono = "=0.4.22" - criterion = { version = "0.4.0", optional = true } ammonia = "3.3.0" async-trait = "0.1.59" blake3 = "1.3.3" bytes = "1.3.0" +chrono = { version = "0.4.23", default-features = false, features = ["std", "clock"] } coarsetime = "0.1.22" convert_case = "0.6.0" dissimilar = "1.0.4" diff --git a/rslib/src/collection/backup.rs b/rslib/src/collection/backup.rs index a08abe76e..bc9a43928 100644 --- a/rslib/src/collection/backup.rs +++ b/rslib/src/collection/backup.rs @@ -104,7 +104,7 @@ fn thin_backups>( ) -> Result<()> { let backups = read_dir(backup_folder)?.filter_map(|entry| entry.ok().and_then(Backup::from_entry)); - let obsolete_backups = BackupFilter::new(Local::today(), limits).obsolete_backups(backups); + let obsolete_backups = BackupFilter::new(Local::now(), limits).obsolete_backups(backups); for backup in obsolete_backups { if let Err(error) = remove_file(&backup.path) { error!(log, "failed to remove {:?}: {error:?}", &backup.path); @@ -176,7 +176,7 @@ enum BackupStage { } impl BackupFilter { - fn new(today: Date, limits: BackupLimits) -> Self { + fn new(today: DateTime, limits: BackupLimits) -> Self { Self { yesterday: today.num_days_from_ce() - 1, last_kept_day: i32::MAX, @@ -262,7 +262,10 @@ mod test { Backup { datetime: Local .from_local_datetime( - &NaiveDate::from_num_days_from_ce($num_days_from_ce).and_hms(0, 0, 0), + &NaiveDate::from_num_days_from_ce_opt($num_days_from_ce) + .unwrap() + .and_hms_opt(0, 0, 0) + .unwrap(), ) .latest() .unwrap(), @@ -271,13 +274,19 @@ mod test { }; ($year:expr, $month:expr, $day:expr) => { Backup { - datetime: Local.ymd($year, $month, $day).and_hms(0, 0, 0), + datetime: Local + .with_ymd_and_hms($year, $month, $day, 0, 0, 0) + .latest() + .unwrap(), path: PathBuf::new(), } }; ($year:expr, $month:expr, $day:expr, $hour:expr, $min:expr, $sec:expr) => { Backup { - datetime: Local.ymd($year, $month, $day).and_hms($hour, $min, $sec), + datetime: Local + .with_ymd_and_hms($year, $month, $day, $hour, $min, $sec) + .latest() + .unwrap(), path: PathBuf::new(), } }; @@ -285,7 +294,10 @@ mod test { #[test] fn thinning_manual() { - let today = Local.ymd(2022, 2, 22); + let today = Local + .with_ymd_and_hms(2022, 2, 22, 0, 0, 0) + .latest() + .unwrap(); let limits = BackupLimits { daily: 3, weekly: 2, @@ -328,7 +340,10 @@ mod test { #[test] fn thinning_generic() { - let today = Local.ymd(2022, 1, 1); + let today = Local + .with_ymd_and_hms(2022, 1, 1, 0, 0, 0) + .latest() + .unwrap(); let today_ce_days = today.num_days_from_ce(); let limits = BackupLimits { // config defaults @@ -357,7 +372,9 @@ mod test { // monthly backups from the last day of the month for _ in 0..limits.monthly { for backup in backup_iter.by_ref() { - if backup.datetime.date().month() != backup.datetime.date().succ().month() { + if backup.datetime.month() + != backup.datetime.date_naive().succ_opt().unwrap().month() + { break; } else { expected.push(backup.clone()) diff --git a/rslib/src/preferences.rs b/rslib/src/preferences.rs index 4c9905ba3..9a0af60e6 100644 --- a/rslib/src/preferences.rs +++ b/rslib/src/preferences.rs @@ -89,7 +89,7 @@ impl Collection { if s.new_timezone { if self.get_creation_utc_offset().is_none() { - self.set_creation_utc_offset(Some(local_minutes_west_for_stamp(created.0)))?; + self.set_creation_utc_offset(Some(local_minutes_west_for_stamp(created)?))?; } } else { self.set_creation_utc_offset(None)?; diff --git a/rslib/src/scheduler/mod.rs b/rslib/src/scheduler/mod.rs index 45739d699..83fb23910 100644 --- a/rslib/src/scheduler/mod.rs +++ b/rslib/src/scheduler/mod.rs @@ -71,13 +71,13 @@ impl Collection { } }; - Ok(sched_timing_today( + sched_timing_today( self.storage.creation_stamp()?, now, self.creation_utc_offset(), current_utc_offset, rollover_hour, - )) + ) } /// In the client case, return the current local timezone offset, @@ -88,7 +88,7 @@ impl Collection { let config_tz = self .get_configured_utc_offset() .and_then(|v| FixedOffset::west_opt(v * 60)) - .unwrap_or_else(|| FixedOffset::west(0)); + .unwrap_or_else(|| FixedOffset::west_opt(0).unwrap()); let local_tz = TimestampSecs::now().local_utc_offset()?; @@ -113,9 +113,7 @@ impl Collection { pub fn rollover_for_current_scheduler(&self) -> Result { match self.scheduler_version() { - SchedulerVersion::V1 => Ok(v1_rollover_from_creation_stamp( - self.storage.creation_stamp()?.0, - )), + SchedulerVersion::V1 => v1_rollover_from_creation_stamp(self.storage.creation_stamp()?), SchedulerVersion::V2 => Ok(self.get_v2_rollover().unwrap_or(4)), } } @@ -123,7 +121,7 @@ impl Collection { pub(crate) fn set_rollover_for_current_scheduler(&mut self, hour: u8) -> Result<()> { match self.scheduler_version() { SchedulerVersion::V1 => self.set_creation_stamp(TimestampSecs( - v1_creation_date_adjusted_to_hour(self.storage.creation_stamp()?.0, hour), + v1_creation_date_adjusted_to_hour(self.storage.creation_stamp()?, hour)?, )), SchedulerVersion::V2 => self.set_v2_rollover(hour as u32), } diff --git a/rslib/src/scheduler/timing.rs b/rslib/src/scheduler/timing.rs index e536cf3f5..eeb52da6b 100644 --- a/rslib/src/scheduler/timing.rs +++ b/rslib/src/scheduler/timing.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use chrono::{Date, Duration, FixedOffset, Local, TimeZone, Timelike}; +use chrono::{DateTime, Datelike, Duration, FixedOffset, Timelike}; use crate::prelude::*; @@ -26,14 +26,13 @@ pub fn sched_timing_today_v2_new( current_secs: TimestampSecs, current_utc_offset: FixedOffset, rollover_hour: u8, -) -> SchedTimingToday { +) -> Result { // get date(times) based on timezone offsets - let created_date = creation_secs.datetime(creation_utc_offset).date(); - let now_datetime = current_secs.datetime(current_utc_offset); - let today = now_datetime.date(); + let created_datetime = creation_secs.datetime(creation_utc_offset)?; + let now_datetime = current_secs.datetime(current_utc_offset)?; // rollover - let rollover_today_datetime = today.and_hms(rollover_hour as u32, 0, 0); + let rollover_today_datetime = rollover_datetime(now_datetime, rollover_hour); let rollover_passed = rollover_today_datetime <= now_datetime; let next_day_at = TimestampSecs(if rollover_passed { (rollover_today_datetime + Duration::days(1)).timestamp() @@ -42,22 +41,33 @@ pub fn sched_timing_today_v2_new( }); // day count - let days_elapsed = days_elapsed(created_date, today, rollover_passed); + let days_elapsed = days_elapsed(created_datetime, now_datetime, rollover_passed); - SchedTimingToday { + Ok(SchedTimingToday { now: current_secs, days_elapsed, next_day_at, - } + }) +} + +fn rollover_datetime(date: DateTime, rollover_hour: u8) -> DateTime { + date.with_hour((rollover_hour % 24) as u32) + .unwrap() + .with_minute(0) + .unwrap() + .with_second(0) + .unwrap() + .with_nanosecond(0) + .unwrap() } /// The number of times the day rolled over between two dates. fn days_elapsed( - start_date: Date, - end_date: Date, + start_date: DateTime, + end_date: DateTime, rollover_passed: bool, ) -> u32 { - let days = (end_date - start_date).num_days(); + let days = end_date.num_days_from_ce() - start_date.num_days_from_ce(); // current day doesn't count before rollover time let days = if rollover_passed { days } else { days - 1 }; @@ -69,33 +79,33 @@ fn days_elapsed( /// Build a FixedOffset struct, capping minutes_west if out of bounds. pub(crate) fn fixed_offset_from_minutes(minutes_west: i32) -> FixedOffset { let bounded_minutes = minutes_west.max(-23 * 60).min(23 * 60); - FixedOffset::west(bounded_minutes * 60) + FixedOffset::west_opt(bounded_minutes * 60).unwrap() } /// For the given timestamp, return minutes west of UTC in the /// local timezone. /// eg, Australia at +10 hours is -600. /// Includes the daylight savings offset if applicable. -pub fn local_minutes_west_for_stamp(stamp: i64) -> i32 { - Local.timestamp(stamp, 0).offset().utc_minus_local() / 60 +pub fn local_minutes_west_for_stamp(stamp: TimestampSecs) -> Result { + Ok(stamp.local_datetime()?.offset().utc_minus_local() / 60) } // Legacy code // ---------------------------------- -pub(crate) fn v1_rollover_from_creation_stamp(crt: i64) -> u8 { - Local.timestamp(crt, 0).hour() as u8 +pub(crate) fn v1_rollover_from_creation_stamp(crt: TimestampSecs) -> Result { + crt.local_datetime().map(|dt| dt.hour() as u8) } pub(crate) fn v1_creation_date() -> i64 { let now = TimestampSecs::now(); - v1_creation_date_inner(now, local_minutes_west_for_stamp(now.0)) + v1_creation_date_inner(now, local_minutes_west_for_stamp(now).unwrap()) } fn v1_creation_date_inner(now: TimestampSecs, mins_west: i32) -> i64 { let offset = fixed_offset_from_minutes(mins_west); - let now_dt = offset.timestamp(now.0, 0); - let four_am_dt = now_dt.date().and_hms(4, 0, 0); + let now_dt = now.datetime(offset).unwrap(); + let four_am_dt = rollover_datetime(now_dt, 4); let four_am_stamp = four_am_dt.timestamp(); if four_am_dt > now_dt { @@ -105,17 +115,17 @@ fn v1_creation_date_inner(now: TimestampSecs, mins_west: i32) -> i64 { } } -pub(crate) fn v1_creation_date_adjusted_to_hour(crt: i64, hour: u8) -> i64 { - let offset = fixed_offset_from_minutes(local_minutes_west_for_stamp(crt)); +pub(crate) fn v1_creation_date_adjusted_to_hour(crt: TimestampSecs, hour: u8) -> Result { + let offset = fixed_offset_from_minutes(local_minutes_west_for_stamp(crt)?); v1_creation_date_adjusted_to_hour_inner(crt, hour, offset) } -fn v1_creation_date_adjusted_to_hour_inner(crt: i64, hour: u8, offset: FixedOffset) -> i64 { - offset - .timestamp(crt, 0) - .date() - .and_hms(hour as u32, 0, 0) - .timestamp() +fn v1_creation_date_adjusted_to_hour_inner( + crt: TimestampSecs, + hour: u8, + offset: FixedOffset, +) -> Result { + Ok(rollover_datetime(crt.datetime(offset)?, hour).timestamp()) } fn sched_timing_today_v1(crt: TimestampSecs, now: TimestampSecs) -> SchedTimingToday { @@ -133,29 +143,22 @@ fn sched_timing_today_v2_legacy( rollover: u8, now: TimestampSecs, current_utc_offset: FixedOffset, -) -> SchedTimingToday { - let crt_at_rollover = crt - .datetime(current_utc_offset) - .date() - .and_hms(rollover as u32, 0, 0) - .timestamp(); +) -> Result { + let crt_at_rollover = + rollover_datetime(crt.datetime(current_utc_offset)?, rollover).timestamp(); let days_elapsed = (now.0 - crt_at_rollover) / 86_400; - let mut next_day_at = TimestampSecs( - now.datetime(current_utc_offset) - .date() - .and_hms(rollover as u32, 0, 0) - .timestamp(), - ); + let mut next_day_at = + TimestampSecs(rollover_datetime(now.datetime(current_utc_offset)?, rollover).timestamp()); if next_day_at < now { next_day_at = next_day_at.adding_secs(86_400); } - SchedTimingToday { + Ok(SchedTimingToday { now, days_elapsed: days_elapsed as u32, next_day_at, - } + }) } // ---------------------------------- @@ -168,11 +171,11 @@ pub(crate) fn sched_timing_today( creation_utc_offset: Option, current_utc_offset: FixedOffset, rollover_hour: Option, -) -> SchedTimingToday { +) -> Result { match (rollover_hour, creation_utc_offset) { (None, _) => { // if rollover unset, v1 scheduler - sched_timing_today_v1(creation_secs, current_secs) + Ok(sched_timing_today_v1(creation_secs, current_secs)) } (Some(rollover), None) => { // if creationOffset unset, v2 scheduler with legacy cutoff handling @@ -193,7 +196,7 @@ pub(crate) fn sched_timing_today( #[cfg(test)] mod test { - use chrono::{FixedOffset, Local, TimeZone, Utc}; + use chrono::{FixedOffset, Local, TimeZone}; use super::*; @@ -213,7 +216,7 @@ mod test { const AEST_MINS_WEST: i32 = -600; fn aest_offset() -> FixedOffset { - FixedOffset::west(AEST_MINS_WEST * 60) + FixedOffset::west_opt(AEST_MINS_WEST * 60).unwrap() } #[test] @@ -226,19 +229,21 @@ mod test { fn elap(start: i64, end: i64, start_west: i32, end_west: i32, rollhour: u8) -> u32 { let start = TimestampSecs(start); let end = TimestampSecs(end); - let start_west = FixedOffset::west(start_west * 60); - let end_west = FixedOffset::west(end_west * 60); - let today = sched_timing_today_v2_new(start, start_west, end, end_west, rollhour); + let start_west = FixedOffset::west_opt(start_west * 60).unwrap(); + let end_west = FixedOffset::west_opt(end_west * 60).unwrap(); + let today = sched_timing_today_v2_new(start, start_west, end, end_west, rollhour).unwrap(); today.days_elapsed } #[test] fn days_elapsed() { - let local_offset = local_minutes_west_for_stamp(Utc::now().timestamp()); + let local_offset = local_minutes_west_for_stamp(TimestampSecs::now()).unwrap(); - let created_dt = FixedOffset::west(local_offset * 60) - .ymd(2019, 12, 1) - .and_hms(2, 0, 0); + let created_dt = FixedOffset::west_opt(local_offset * 60) + .unwrap() + .with_ymd_and_hms(2019, 12, 1, 2, 0, 0) + .latest() + .unwrap(); let crt = created_dt.timestamp(); // days can't be negative @@ -261,33 +266,60 @@ mod test { 1 ); - let mdt = FixedOffset::west(6 * 60 * 60); + let mdt = FixedOffset::west_opt(6 * 60 * 60).unwrap(); let mdt_offset = mdt.utc_minus_local() / 60; - let mst = FixedOffset::west(7 * 60 * 60); + let mst = FixedOffset::west_opt(7 * 60 * 60).unwrap(); let mst_offset = mst.utc_minus_local() / 60; // a collection created @ midnight in MDT in the past - let crt = mdt.ymd(2018, 8, 6).and_hms(0, 0, 0).timestamp(); + let crt = mdt + .with_ymd_and_hms(2018, 8, 6, 0, 0, 0) + .latest() + .unwrap() + .timestamp(); // with the current time being MST - let now = mst.ymd(2019, 12, 26).and_hms(20, 0, 0).timestamp(); + let now = mst + .with_ymd_and_hms(2019, 12, 26, 20, 0, 0) + .latest() + .unwrap() + .timestamp(); assert_eq!(elap(crt, now, mdt_offset, mst_offset, 4), 507); // the previous implementation generated a different elapsed number of days with a change // to DST, but the number shouldn't change assert_eq!(elap(crt, now, mdt_offset, mdt_offset, 4), 507); // collection created at 3am on the 6th, so day 1 starts at 4am on the 7th, and day 3 on the 9th. - let crt = mdt.ymd(2018, 8, 6).and_hms(3, 0, 0).timestamp(); - let now = mst.ymd(2018, 8, 9).and_hms(1, 59, 59).timestamp(); + let crt = mdt + .with_ymd_and_hms(2018, 8, 6, 3, 0, 0) + .latest() + .unwrap() + .timestamp(); + let now = mst + .with_ymd_and_hms(2018, 8, 9, 1, 59, 59) + .latest() + .unwrap() + .timestamp(); assert_eq!(elap(crt, now, mdt_offset, mst_offset, 4), 2); - let now = mst.ymd(2018, 8, 9).and_hms(3, 59, 59).timestamp(); + let now = mst + .with_ymd_and_hms(2018, 8, 9, 3, 59, 59) + .latest() + .unwrap() + .timestamp(); assert_eq!(elap(crt, now, mdt_offset, mst_offset, 4), 2); - let now = mst.ymd(2018, 8, 9).and_hms(4, 0, 0).timestamp(); + let now = mst + .with_ymd_and_hms(2018, 8, 9, 4, 0, 0) + .latest() + .unwrap() + .timestamp(); assert_eq!(elap(crt, now, mdt_offset, mst_offset, 4), 3); // try a bunch of combinations of creation time, current time, and rollover hour let hours_of_interest = &[0, 1, 4, 12, 22, 23]; for creation_hour in hours_of_interest { - let crt_dt = mdt.ymd(2018, 8, 6).and_hms(*creation_hour, 0, 0); + let crt_dt = mdt + .with_ymd_and_hms(2018, 8, 6, *creation_hour, 0, 0) + .latest() + .unwrap(); let crt_stamp = crt_dt.timestamp(); let crt_offset = mdt_offset; @@ -295,8 +327,9 @@ mod test { for current_hour in hours_of_interest { for rollover_hour in hours_of_interest { let end_dt = mdt - .ymd(2018, 8, 6 + current_day) - .and_hms(*current_hour, 0, 0); + .with_ymd_and_hms(2018, 8, 6 + current_day, *current_hour, 0, 0) + .latest() + .unwrap(); let end_stamp = end_dt.timestamp(); let end_offset = mdt_offset; let elap_day = if *current_hour < *rollover_hour { @@ -324,42 +357,66 @@ mod test { #[test] fn next_day_at() { let rollhour = 4; - let crt = Local.ymd(2019, 1, 1).and_hms(2, 0, 0); + let crt = Local + .with_ymd_and_hms(2019, 1, 1, 2, 0, 0) + .latest() + .unwrap(); // before the rollover, the next day should be later on the same day - let now = Local.ymd(2019, 1, 3).and_hms(2, 0, 0); - let next_day_at = Local.ymd(2019, 1, 3).and_hms(rollhour, 0, 0); + let now = Local + .with_ymd_and_hms(2019, 1, 3, 2, 0, 0) + .latest() + .unwrap(); + let next_day_at = Local + .with_ymd_and_hms(2019, 1, 3, rollhour, 0, 0) + .latest() + .unwrap(); let today = sched_timing_today_v2_new( TimestampSecs(crt.timestamp()), *crt.offset(), TimestampSecs(now.timestamp()), *now.offset(), rollhour as u8, - ); + ) + .unwrap(); assert_eq!(today.next_day_at.0, next_day_at.timestamp()); // after the rollover, the next day should be the next day - let now = Local.ymd(2019, 1, 3).and_hms(rollhour, 0, 0); - let next_day_at = Local.ymd(2019, 1, 4).and_hms(rollhour, 0, 0); + let now = Local + .with_ymd_and_hms(2019, 1, 3, rollhour, 0, 0) + .latest() + .unwrap(); + let next_day_at = Local + .with_ymd_and_hms(2019, 1, 4, rollhour, 0, 0) + .latest() + .unwrap(); let today = sched_timing_today_v2_new( TimestampSecs(crt.timestamp()), *crt.offset(), TimestampSecs(now.timestamp()), *now.offset(), rollhour as u8, - ); + ) + .unwrap(); assert_eq!(today.next_day_at.0, next_day_at.timestamp()); // after the rollover, the next day should be the next day - let now = Local.ymd(2019, 1, 3).and_hms(rollhour + 3, 0, 0); - let next_day_at = Local.ymd(2019, 1, 4).and_hms(rollhour, 0, 0); + let now = Local + .with_ymd_and_hms(2019, 1, 3, rollhour + 3, 0, 0) + .latest() + .unwrap(); + let next_day_at = Local + .with_ymd_and_hms(2019, 1, 4, rollhour, 0, 0) + .latest() + .unwrap(); let today = sched_timing_today_v2_new( TimestampSecs(crt.timestamp()), *crt.offset(), TimestampSecs(now.timestamp()), *now.offset(), rollhour as u8, - ); + ) + .unwrap(); assert_eq!(today.next_day_at.0, next_day_at.timestamp()); } @@ -378,20 +435,20 @@ mod test { assert_eq!( sched_timing_today_v2_legacy(TimestampSecs(1533564000), 0, now, aest_offset()), - SchedTimingToday { + Ok(SchedTimingToday { now, days_elapsed: 589, next_day_at: TimestampSecs(1584540000) - } + }) ); assert_eq!( sched_timing_today_v2_legacy(TimestampSecs(1524038400), 4, now, aest_offset()), - SchedTimingToday { + Ok(SchedTimingToday { now, days_elapsed: 700, next_day_at: TimestampSecs(1584554400) - } + }) ); } @@ -399,26 +456,49 @@ mod test { fn legacy_creation_stamp() { let offset = fixed_offset_from_minutes(AEST_MINS_WEST); - let now = TimestampSecs(offset.ymd(2020, 5, 10).and_hms(9, 30, 30).timestamp()); + let now = TimestampSecs( + offset + .with_ymd_and_hms(2020, 5, 10, 9, 30, 30) + .latest() + .unwrap() + .timestamp(), + ); assert_eq!( v1_creation_date_inner(now, AEST_MINS_WEST), - offset.ymd(2020, 5, 10).and_hms(4, 0, 0).timestamp() + offset + .with_ymd_and_hms(2020, 5, 10, 4, 0, 0) + .latest() + .unwrap() + .timestamp() ); - let now = TimestampSecs(offset.ymd(2020, 5, 10).and_hms(1, 30, 30).timestamp()); + let now = TimestampSecs( + offset + .with_ymd_and_hms(2020, 5, 10, 1, 30, 30) + .latest() + .unwrap() + .timestamp(), + ); assert_eq!( v1_creation_date_inner(now, AEST_MINS_WEST), - offset.ymd(2020, 5, 9).and_hms(4, 0, 0).timestamp() + offset + .with_ymd_and_hms(2020, 5, 9, 4, 0, 0) + .latest() + .unwrap() + .timestamp() ); - let crt = v1_creation_date_inner(now, AEST_MINS_WEST); - assert_eq!(crt, v1_creation_date_adjusted_to_hour_inner(crt, 4, offset)); + let crt = TimestampSecs(v1_creation_date_inner(now, AEST_MINS_WEST)); assert_eq!( - crt + 3600, + Ok(crt.0), + v1_creation_date_adjusted_to_hour_inner(crt, 4, offset) + ); + assert_eq!( + Ok(crt.0 + 3600), v1_creation_date_adjusted_to_hour_inner(crt, 5, offset) ); assert_eq!( - crt - 3600 * 4, + Ok(crt.0 - 3600 * 4), v1_creation_date_adjusted_to_hour_inner(crt, 0, offset) ); } diff --git a/rslib/src/scheduler/upgrade.rs b/rslib/src/scheduler/upgrade.rs index 6ba42d8ab..f9a42918f 100644 --- a/rslib/src/scheduler/upgrade.rs +++ b/rslib/src/scheduler/upgrade.rs @@ -122,7 +122,7 @@ impl Collection { // enable new timezone code by default let created = self.storage.creation_stamp()?; if self.get_creation_utc_offset().is_none() { - self.set_creation_utc_offset(Some(local_minutes_west_for_stamp(created.0)))?; + self.set_creation_utc_offset(Some(local_minutes_west_for_stamp(created)?))?; } // force full sync diff --git a/rslib/src/storage/sqlite.rs b/rslib/src/storage/sqlite.rs index 869448987..afd078e16 100644 --- a/rslib/src/storage/sqlite.rs +++ b/rslib/src/storage/sqlite.rs @@ -14,11 +14,10 @@ use super::{ }; use crate::{ config::schema11::schema11_config_as_string, - error::{AnkiError, DbErrorKind, Result}, - i18n::I18n, + error::DbErrorKind, + prelude::*, scheduler::timing::{local_minutes_west_for_stamp, v1_creation_date}, text::without_combining, - timestamp::TimestampMillis, }; fn unicase_compare(s1: &str, s2: &str) -> Ordering { @@ -231,11 +230,11 @@ impl SqliteStorage { if create { db.execute_batch(include_str!("schema11.sql"))?; // start at schema 11, then upgrade below - let crt = v1_creation_date(); + let crt = TimestampSecs(v1_creation_date()); let offset = if server { None } else { - Some(local_minutes_west_for_stamp(crt)) + Some(local_minutes_west_for_stamp(crt)?) }; db.execute( "update col set crt=?, scm=?, ver=?, conf=?", diff --git a/rslib/src/timestamp.rs b/rslib/src/timestamp.rs index 4f6da5dc4..ba07167a5 100644 --- a/rslib/src/timestamp.rs +++ b/rslib/src/timestamp.rs @@ -31,17 +31,11 @@ impl TimestampSecs { TimestampMillis(self.0 * 1000) } - #[cfg(windows)] pub(crate) fn local_datetime(self) -> Result> { - std::panic::catch_unwind(|| Local.timestamp(self.0, 0)) - // discard error as it doesn't satisfiy trait bounds - .ok() - .or_invalid("invalid date") - } - - #[cfg(not(windows))] - pub(crate) fn local_datetime(self) -> Result> { - Ok(Local.timestamp(self.0, 0)) + Local + .timestamp_opt(self.0, 0) + .latest() + .or_invalid("invalid timestamp") } /// YYYY-mm-dd @@ -62,8 +56,11 @@ impl TimestampSecs { Ok(*self.local_datetime()?.offset()) } - pub fn datetime(self, utc_offset: FixedOffset) -> DateTime { - utc_offset.timestamp(self.0, 0) + pub fn datetime(self, utc_offset: FixedOffset) -> Result> { + utc_offset + .timestamp_opt(self.0, 0) + .latest() + .or_invalid("invalid timestamp") } pub fn adding_secs(self, secs: i64) -> Self {