From b4ae810490455fd4ed8166a96f4eddc8c1d758a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 00:56:55 +0100 Subject: [PATCH] chore(dep): bump the test-deps group across 1 directory with 2 updates (#552) * chore(dep): bump the test-deps group across 1 directory with 2 updates Bumps the test-deps group with 2 updates in the /crates/rsonpath-test-codegen directory: [serde](https://github.com/serde-rs/serde) and [proc-macro2](https://github.com/dtolnay/proc-macro2). Updates `serde` from 1.0.210 to 1.0.213 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.210...v1.0.213) Updates `proc-macro2` from 1.0.86 to 1.0.89 - [Release notes](https://github.com/dtolnay/proc-macro2/releases) - [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.86...1.0.89) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch dependency-group: test-deps - dependency-name: proc-macro2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: test-deps ... Signed-off-by: dependabot[bot] * chore: fix `Punct` usage of `proc_macro2` in test generation Apparently using `Punct` for parantheses was always invalid, and in the latest update it became a hard error. The `Group` object needs to be used instead to surround a stream of tokens in delimiters. --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mateusz Gienieczko --- crates/rsonpath-test-codegen/Cargo.lock | 16 ++++----- crates/rsonpath-test-codegen/Cargo.toml | 4 +-- crates/rsonpath-test-codegen/src/model.rs | 41 +++++++++++------------ 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/crates/rsonpath-test-codegen/Cargo.lock b/crates/rsonpath-test-codegen/Cargo.lock index 7c3a2951..8f551a9a 100644 --- a/crates/rsonpath-test-codegen/Cargo.lock +++ b/crates/rsonpath-test-codegen/Cargo.lock @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -94,18 +94,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" dependencies = [ "proc-macro2", "quote", diff --git a/crates/rsonpath-test-codegen/Cargo.toml b/crates/rsonpath-test-codegen/Cargo.toml index fe5d5288..3f2dca9e 100644 --- a/crates/rsonpath-test-codegen/Cargo.toml +++ b/crates/rsonpath-test-codegen/Cargo.toml @@ -15,9 +15,9 @@ rust-version = "1.70.0" publish = false [dependencies] -serde = { version = "1.0.210", features = ["derive"] } +serde = { version = "1.0.213", features = ["derive"] } toml = "0.8.19" -proc-macro2 = "1.0.86" +proc-macro2 = "1.0.89" quote = "1.0.37" heck = { version = "0.5.0" } walkdir = "2.5.0" diff --git a/crates/rsonpath-test-codegen/src/model.rs b/crates/rsonpath-test-codegen/src/model.rs index a9cde9a6..2dbb25df 100644 --- a/crates/rsonpath-test-codegen/src/model.rs +++ b/crates/rsonpath-test-codegen/src/model.rs @@ -1,8 +1,6 @@ //! Type definitions and serde support for the TOML configuration files. -use std::{cmp, error::Error, fmt::Display, path::PathBuf}; - -use quote::TokenStreamExt; use serde::{Deserialize, Serialize}; +use std::{cmp, error::Error, fmt::Display, path::PathBuf}; /// Top-level test configuration. #[derive(Debug, Deserialize, Serialize, Clone)] @@ -128,35 +126,36 @@ impl<'de> Deserialize<'de> for ResultSpan { impl quote::ToTokens for ResultApproximateSpan { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { - use proc_macro2::{Ident, Punct, Spacing, Span}; - tokens.append(Punct::new('(', Spacing::Alone)); - self.start.to_tokens(tokens); - tokens.append(Punct::new(',', Spacing::Alone)); - self.end_lower_bound.to_tokens(tokens); - tokens.append(Punct::new(',', Spacing::Alone)); + use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream}; + let mut outer_group = TokenStream::new(); + + self.start.to_tokens(&mut outer_group); + Punct::new(',', Spacing::Alone).to_tokens(&mut outer_group); + self.end_lower_bound.to_tokens(&mut outer_group); + Punct::new(',', Spacing::Alone).to_tokens(&mut outer_group); match self.end_upper_bound { Some(x) => { - tokens.append(Ident::new("Some", Span::call_site())); - tokens.append(Punct::new('(', Spacing::Alone)); - x.to_tokens(tokens); - tokens.append(Punct::new(')', Spacing::Alone)); + Ident::new("Some", Span::call_site()).to_tokens(&mut outer_group); + Group::new(Delimiter::Parenthesis, x.to_token_stream()).to_tokens(&mut outer_group); } - None => tokens.append(Ident::new("None", Span::call_site())), + None => Ident::new("None", Span::call_site()).to_tokens(&mut outer_group), } - tokens.append(Punct::new(')', Spacing::Alone)); + Group::new(Delimiter::Parenthesis, outer_group).to_tokens(tokens); } } impl quote::ToTokens for ResultSpan { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { - use proc_macro2::{Punct, Spacing}; - tokens.append(Punct::new('(', Spacing::Alone)); - self.start.to_tokens(tokens); - tokens.append(Punct::new(',', Spacing::Alone)); - self.end.to_tokens(tokens); - tokens.append(Punct::new(')', Spacing::Alone)); + use proc_macro2::{Delimiter, Group, Punct, Spacing, TokenStream}; + let mut group = TokenStream::new(); + + self.start.to_tokens(&mut group); + Punct::new(',', Spacing::Alone).to_tokens(&mut group); + self.end.to_tokens(&mut group); + + Group::new(Delimiter::Parenthesis, group).to_tokens(tokens); } }