From d7ec6d1cbdc36bece452dd3d28938cbedb881415 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 23 Feb 2025 17:48:22 +0000 Subject: [PATCH 1/2] feat: bytesize v2 --- .cspell.yml | 6 +++++ .github/workflows/ci.yml | 2 +- Cargo.lock | 25 ++++++------------- Cargo.toml | 2 +- .../tests/trybuild/fail-default-parse.stderr | 2 +- .../fail-field-from-unknown-type.stderr | 20 ++++----------- confik/CHANGELOG.md | 2 ++ confik/Cargo.toml | 2 +- confik/src/lib.rs | 1 - justfile | 7 +++--- 10 files changed, 28 insertions(+), 41 deletions(-) diff --git a/.cspell.yml b/.cspell.yml index 4c222d1..10d52f2 100644 --- a/.cspell.yml +++ b/.cspell.yml @@ -3,6 +3,7 @@ words: - bigdecimal - bytesize - chrono + - clippy - codecov - confik - dataless @@ -15,11 +16,16 @@ words: - indoc - ipnetwork - msrv + - nextest + - nixpkgs + - powerset - rustc - rustdoc + - rustup - rustversion - serde - struct + - taplo - tempfile - thiserror - trybuild diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15a5d32..7bd7310 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: - name: workaround MSRV issues if: matrix.toolchain.name == 'msrv' - run: just downgrade-msrv + run: just downgrade-for-msrv - name: Test run: just test-no-coverage diff --git a/Cargo.lock b/Cargo.lock index 4bde69c..a33e447 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,9 +150,9 @@ checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "bytesize" -version = "1.3.2" +version = "2.0.0-beta.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2c12f985c78475a6b8d629afd0c360260ef34cfef52efccdcfd31972f81c2e" +checksum = "5b26f32426af550ab3195cc3da7b115a6f4599b79dd180bb7f1d77d978aa6aaa" dependencies = [ "serde", ] @@ -337,7 +337,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] @@ -962,7 +962,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] @@ -1162,9 +1162,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-triple" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a4d50cdb458045afc8131fd91b64904da29548bcb63c7236e0844936c13078" +checksum = "1ac9aa371f599d22256307c24a9d748c041e548cbf599f35d890f9d365361790" [[package]] name = "temp-env" @@ -1186,7 +1186,7 @@ dependencies = [ "getrandom 0.3.1", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -1465,7 +1465,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -1486,15 +1486,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-targets" version = "0.52.6" diff --git a/Cargo.toml b/Cargo.toml index e901f21..db951df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ categories = ["config"] repository = "https://github.com/x52dev/confik" license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [patch.crates-io] confik = { path = "confik" } diff --git a/confik-macros/tests/trybuild/fail-default-parse.stderr b/confik-macros/tests/trybuild/fail-default-parse.stderr index ebfa799..b203b64 100644 --- a/confik-macros/tests/trybuild/fail-default-parse.stderr +++ b/confik-macros/tests/trybuild/fail-default-parse.stderr @@ -5,7 +5,7 @@ error[E0277]: the trait bound `usize: From` is not satisfied | ^---- | | | the trait `From` is not implemented for `usize` - | this tail expression is of type `_` + | this tail expression is of type `i32` | = help: the following other types implement trait `From`: > diff --git a/confik-macros/tests/trybuild/fail-field-from-unknown-type.stderr b/confik-macros/tests/trybuild/fail-field-from-unknown-type.stderr index 41e3885..b2cd346 100644 --- a/confik-macros/tests/trybuild/fail-field-from-unknown-type.stderr +++ b/confik-macros/tests/trybuild/fail-field-from-unknown-type.stderr @@ -1,26 +1,16 @@ error[E0412]: cannot find type `A` in this scope --> tests/trybuild/fail-field-from-unknown-type.rs:6:21 | -5 | struct Config { - | - help: you might be missing a type parameter: `` 6 | #[confik(from = A)] | ^ not found in this scope + | +help: you might be missing a type parameter + | +5 | struct Config { + | +++ error[E0412]: cannot find type `A` in this scope --> tests/trybuild/fail-field-from-unknown-type.rs:6:21 | 6 | #[confik(from = A)] | ^ not found in this scope - -error[E0283]: type annotations needed - --> tests/trybuild/fail-field-from-unknown-type.rs:6:21 - | -5 | struct Config { - | ------ in this derive macro expansion -6 | #[confik(from = A)] - | _____________________^ -7 | | param: String, - | |_________^ cannot infer type - | - = note: cannot satisfy `_: Default` - = note: this error originates in the derive macro `::std::default::Default` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/confik/CHANGELOG.md b/confik/CHANGELOG.md index 769cf41..b52b417 100644 --- a/confik/CHANGELOG.md +++ b/confik/CHANGELOG.md @@ -2,7 +2,9 @@ ## Unreleased +- Update `bytesize` dependency to `2`. - Update `ipnetwork` dependency to `0.21`. +- Minimum supported Rust version (MSRV) is now 1.70. ## 0.12.0 diff --git a/confik/Cargo.toml b/confik/Cargo.toml index cd9c908..2af74e6 100644 --- a/confik/Cargo.toml +++ b/confik/Cargo.toml @@ -52,7 +52,7 @@ serde_json = { version = "1", optional = true } toml = { version = "0.8", optional = true, default-features = false, features = ["parse"] } bigdecimal = { version = "0.4", optional = true, features = ["serde"] } -bytesize = { version = "1", optional = true, features = ["serde"] } +bytesize = { version = "2.0.0-beta.1", optional = true, features = ["serde"] } camino = { version = "1", optional = true, features = ["serde1"] } chrono = { version = "0.4.39", optional = true, default-features = false, features = ["serde"] } ipnetwork = { version = "0.21", optional = true, features = ["serde"] } diff --git a/confik/src/lib.rs b/confik/src/lib.rs index 0dd50c5..70be842 100644 --- a/confik/src/lib.rs +++ b/confik/src/lib.rs @@ -107,7 +107,6 @@ where // If there was no data then we're missing values .ok_or_else(|| Error::MissingValue(MissingValue::default()))?? .try_build() - .map_err(Into::into) } /// The target to be deserialized from multiple sources. diff --git a/justfile b/justfile index 81b8f3c..4d89458 100644 --- a/justfile +++ b/justfile @@ -16,12 +16,11 @@ msrv_rustup := "+" + msrv # Downgrade dev-dependencies necessary to run MSRV checks/tests. [private] -downgrade-msrv: - cargo update -p=trybuild --precise=1.0.90 - cargo update -p=serde_with --precise=3.11.0 +downgrade-for-msrv: + # no downgrades currently needed # Test workspace using MSRV -test-msrv: downgrade-msrv (test-no-coverage msrv_rustup) +test-msrv: downgrade-for-msrv (test-no-coverage msrv_rustup) # Test workspace without generating coverage files [private] From aa9a6399da617d7f902a56acad9253923b130ffd Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 23 Feb 2025 18:59:31 +0000 Subject: [PATCH 2/2] build: update flake inputs --- Cargo.lock | 4 ++-- confik/Cargo.toml | 2 +- confik/src/lib.md | 2 +- flake.lock | 22 +++++++++++----------- flake.nix | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a33e447..a1f0f0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,9 +150,9 @@ checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "bytesize" -version = "2.0.0-beta.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b26f32426af550ab3195cc3da7b115a6f4599b79dd180bb7f1d77d978aa6aaa" +checksum = "ce3dbc6ab70a821f3e9c36084d4c1a96f50006fd41697123d3fe0a5f03d5912c" dependencies = [ "serde", ] diff --git a/confik/Cargo.toml b/confik/Cargo.toml index 2af74e6..d90ab96 100644 --- a/confik/Cargo.toml +++ b/confik/Cargo.toml @@ -52,7 +52,7 @@ serde_json = { version = "1", optional = true } toml = { version = "0.8", optional = true, default-features = false, features = ["parse"] } bigdecimal = { version = "0.4", optional = true, features = ["serde"] } -bytesize = { version = "2.0.0-beta.1", optional = true, features = ["serde"] } +bytesize = { version = "2", optional = true, features = ["serde"] } camino = { version = "1", optional = true, features = ["serde1"] } chrono = { version = "0.4.39", optional = true, default-features = false, features = ["serde"] } ipnetwork = { version = "0.21", optional = true, features = ["serde"] } diff --git a/confik/src/lib.md b/confik/src/lib.md index e9ce180..ac64049 100644 --- a/confik/src/lib.md +++ b/confik/src/lib.md @@ -182,7 +182,7 @@ Defaults are specified on a per-field basis. This crate provides implementations of [`Configuration`] for a number of `std` types and the following third-party crates. Implementations for third-party crates are feature gated. - `bigdecimal`: v0.4 -- `bytesize`: v1 +- `bytesize`: v2 - `camino`: v1 - `chrono`: v0.4 - `ipnetwork`: v0.21 diff --git a/flake.lock b/flake.lock index 50db5f6..1890a3c 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1736143030, - "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", "type": "github" }, "original": { @@ -20,30 +20,30 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720535198, - "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", + "lastModified": 1740162160, + "narHash": "sha256-SSYxFhqCOb3aiPb6MmN68yEzBIltfom8IgRz7phHscM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", + "rev": "11415c7ae8539d6292f2928317ee7a8410b28bb9", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.11", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-lib": { "locked": { - "lastModified": 1738005753, - "narHash": "sha256-CewEm1o2eVAnoqb6Ml+Qi9Gg/EfNAxbRx1lANGVyoLI=", + "lastModified": 1738452942, + "narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" } }, "root": { diff --git a/flake.nix b/flake.nix index b87ae9d..70a2e69 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; flake-parts.url = "github:hercules-ci/flake-parts"; };