From d12e943590208da738c092db92c34b39796a2538 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 23 Aug 2025 09:12:30 -0700 Subject: [PATCH 1/8] Update actions/checkout@v4 -> v5 --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77d611a09..111861161 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: os: [ubuntu, windows] timeout-minutes: 45 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@nightly - run: cargo test - run: cargo test --features preserve_order --tests -- --skip ui --exact @@ -54,7 +54,7 @@ jobs: os: windows timeout-minutes: 45 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{matrix.rust}} @@ -80,7 +80,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 45 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@nightly - run: cargo generate-lockfile -Z minimal-versions - run: cargo check --locked @@ -104,7 +104,7 @@ jobs: MIRIFLAGS: -Zmiri-strict-provenance timeout-minutes: 45 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@miri - run: cargo miri setup - run: cargo miri test --target ${{matrix.target}} @@ -116,7 +116,7 @@ jobs: if: github.event_name != 'pull_request' timeout-minutes: 45 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@clippy - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic - run: cargo clippy --all-features --tests -- -Dclippy::all -Dclippy::pedantic @@ -128,7 +128,7 @@ jobs: env: RUSTDOCFLAGS: -Dwarnings steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/install@cargo-docs-rs - run: cargo docs-rs @@ -138,7 +138,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 45 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/install@cargo-fuzz - run: cargo fuzz check @@ -149,7 +149,7 @@ jobs: if: github.event_name != 'pull_request' timeout-minutes: 45 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable - uses: dtolnay/install@cargo-outdated - run: cargo outdated --exit-code 1 From 0bf5d87003aebbbb2b46c96e668283215971d98d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 13 Sep 2025 14:49:51 -0700 Subject: [PATCH 2/8] Enforce trybuild >= 1.0.108 Older versions produce slightly differently normalized output when run against 1.90.0+ Rust compiler. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4e7a02723..cd2619300 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ serde = { version = "1.0.194", features = ["derive"] } serde_bytes = "0.11.10" serde_derive = "1.0.166" serde_stacker = "0.1.8" -trybuild = { version = "1.0.81", features = ["diff"] } +trybuild = { version = "1.0.108", features = ["diff"] } [package.metadata.docs.rs] features = ["preserve_order", "raw_value", "unbounded_depth"] From 1dbc803749213eca37080cc7f29f5aee3ac18941 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 13 Sep 2025 16:19:51 -0700 Subject: [PATCH 3/8] Raise required compiler to Rust 1.61 --- .github/workflows/ci.yml | 9 +++++---- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 111861161..7e56d3cfe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [beta, 1.65.0, 1.56.1] + rust: [beta, 1.65.0, 1.61.0] os: [ubuntu] include: - rust: stable @@ -68,11 +68,12 @@ jobs: - run: cargo check --manifest-path tests/crate/Cargo.toml --no-default-features --features alloc,arbitrary_precision - run: cargo check --manifest-path tests/crate/Cargo.toml --no-default-features --features alloc,raw_value - run: cargo check --manifest-path tests/crate/Cargo.toml --features serde_json/preserve_order - if: matrix.rust != '1.56.1' + if: matrix.rust != '1.61.0' - run: cargo check --manifest-path tests/crate/Cargo.toml --no-default-features --features alloc,serde_json/preserve_order - if: matrix.rust != '1.56.1' + if: matrix.rust != '1.61.0' - name: Build without std - run: cargo check --manifest-path tests/crate/Cargo.toml --target ${{matrix.target}} --no-default-features --features alloc + run: cargo check --manifest-path tests/crate/Cargo.toml --target + ${{matrix.target}} --no-default-features --features alloc if: matrix.target minimal: diff --git a/Cargo.toml b/Cargo.toml index cd2619300..cec28d336 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" keywords = ["json", "serde", "serialization"] license = "MIT OR Apache-2.0" repository = "https://github.com/serde-rs/json" -rust-version = "1.56" +rust-version = "1.61" [dependencies] indexmap = { version = "2.2.3", optional = true } From d21e8ce7a7cc0bab2d53293de42b6343ef1d9144 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 13 Sep 2025 16:06:28 -0700 Subject: [PATCH 4/8] Switch serde dependency to serde_core --- Cargo.toml | 6 +++--- src/lib.rs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cec28d336..562d9359f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ indexmap = { version = "2.2.3", optional = true } itoa = "1.0" memchr = { version = "2", default-features = false } ryu = "1.0" -serde = { version = "1.0.194", default-features = false } +serde_core = { version = "1.0.220", default-features = false } [dev-dependencies] automod = "1.0.11" @@ -48,12 +48,12 @@ features = ["float_roundtrip", "raw_value", "unbounded_depth"] [features] default = ["std"] -std = ["memchr/std", "serde/std"] +std = ["memchr/std", "serde_core/std"] # Provide integration for heap-allocated collections without depending on the # rest of the Rust standard library. # NOTE: Disabling both `std` *and* `alloc` features is not supported yet. -alloc = ["serde/alloc"] +alloc = ["serde_core/alloc"] # Make serde_json::Map use a representation which maintains insertion order. # This allows data to be read into a Value and written back to a JSON string diff --git a/src/lib.rs b/src/lib.rs index f77fa73f4..296149cd7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -378,6 +378,8 @@ extern crate alloc; #[cfg(feature = "std")] extern crate std; +extern crate serde_core as serde; + // Not public API. Used from macro-generated code. #[doc(hidden)] pub mod __private { From caef3c6ea69e126d18ee8b43dcc2c89d81207815 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 13 Sep 2025 16:32:54 -0700 Subject: [PATCH 5/8] Ignore uninlined_format_args pedantic clippy lint warning: variables can be used directly in the `format!` string --> src/ser.rs:448:15 | 448 | match write!(adapter, "{}", value) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args = note: `-W clippy::uninlined-format-args` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::uninlined_format_args)]` help: change this to | 448 - match write!(adapter, "{}", value) { 448 + match write!(adapter, "{value}") { | warning: variables can be used directly in the `format!` string --> src/value/mod.rs:182:37 | 182 | Value::Bool(boolean) => write!(formatter, "Bool({})", boolean), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 182 - Value::Bool(boolean) => write!(formatter, "Bool({})", boolean), 182 + Value::Bool(boolean) => write!(formatter, "Bool({boolean})"), | warning: variables can be used directly in the `format!` string --> src/value/mod.rs:184:38 | 184 | Value::String(string) => write!(formatter, "String({:?})", string), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 184 - Value::String(string) => write!(formatter, "String({:?})", string), 184 + Value::String(string) => write!(formatter, "String({string:?})"), | warning: variables can be used directly in the `format!` string --> src/number.rs:365:9 | 365 | write!(formatter, "Number({})", self) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 365 - write!(formatter, "Number({})", self) 365 + write!(formatter, "Number({self})") | --- src/lib.rs | 1 + tests/debug.rs | 2 ++ tests/test.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 296149cd7..a98ec5274 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -320,6 +320,7 @@ clippy::transmute_ptr_to_ptr, clippy::unbuffered_bytes, clippy::unconditional_recursion, // https://github.com/rust-lang/rust-clippy/issues/12133 + clippy::uninlined_format_args, clippy::unnecessary_wraps )] // Ignored clippy_pedantic lints diff --git a/tests/debug.rs b/tests/debug.rs index 8ddcf5a38..adf475d93 100644 --- a/tests/debug.rs +++ b/tests/debug.rs @@ -1,3 +1,5 @@ +#![allow(clippy::uninlined_format_args)] + use indoc::indoc; use serde_json::{json, Number, Value}; diff --git a/tests/test.rs b/tests/test.rs index d41a2336a..f608679e6 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -11,6 +11,7 @@ clippy::let_underscore_untyped, clippy::shadow_unrelated, clippy::too_many_lines, + clippy::uninlined_format_args, clippy::unreadable_literal, clippy::unseparated_literal_suffix, clippy::vec_init_then_push, From fc27bafbf740abc5e5733ec1dd2b5ae25695f895 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 13 Sep 2025 16:35:55 -0700 Subject: [PATCH 6/8] Release 1.0.144 --- Cargo.toml | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 562d9359f..5acbbd34e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.143" +version = "1.0.144" authors = ["Erick Tryzelaar ", "David Tolnay "] categories = ["encoding", "parser-implementations", "no-std"] description = "A JSON serialization file format" diff --git a/src/lib.rs b/src/lib.rs index a98ec5274..7e7a29d3b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -299,7 +299,7 @@ //! [macro]: crate::json //! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.143")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.144")] // Ignored clippy lints #![allow( clippy::collapsible_else_if, From 23679e2b9d7e4dcaef797ca7c51a4ffb6fce9f36 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 14 Sep 2025 08:48:39 -0700 Subject: [PATCH 7/8] Add serde version constraint --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 5acbbd34e..5228df2ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,9 @@ memchr = { version = "2", default-features = false } ryu = "1.0" serde_core = { version = "1.0.220", default-features = false } +[target.'cfg(any())'.dependencies] +serde = { version = "1.0.220", default-features = false } + [dev-dependencies] automod = "1.0.11" indoc = "2.0.2" From efa66e3a1d61459ab2d325f92ebe3acbd6ca18b1 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 14 Sep 2025 08:55:56 -0700 Subject: [PATCH 8/8] Release 1.0.145 --- Cargo.toml | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5228df2ff..49cd07273 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.144" +version = "1.0.145" authors = ["Erick Tryzelaar ", "David Tolnay "] categories = ["encoding", "parser-implementations", "no-std"] description = "A JSON serialization file format" diff --git a/src/lib.rs b/src/lib.rs index 7e7a29d3b..9669d70b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -299,7 +299,7 @@ //! [macro]: crate::json //! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.144")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.145")] // Ignored clippy lints #![allow( clippy::collapsible_else_if,