Skip to content

Commit

Permalink
Incorporate PR feedback from @ahl
Browse files Browse the repository at this point in the history
  • Loading branch information
anelson committed Dec 1, 2024
1 parent 644e688 commit 4bfc9ac
Show file tree
Hide file tree
Showing 21 changed files with 2,694 additions and 2,648 deletions.
4 changes: 2 additions & 2 deletions cargo-typify/tests/outputs/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ impl Veggie {
#[doc = r" </details>"]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
pub struct Veggies {
#[serde(default, skip_serializing_if = "std::vec::Vec::is_empty")]
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub fruits: ::std::vec::Vec<::std::string::String>,
#[serde(default, skip_serializing_if = "std::vec::Vec::is_empty")]
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl From<&Veggies> for Veggies {
Expand Down
4 changes: 2 additions & 2 deletions cargo-typify/tests/outputs/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ impl From<&Veggie> for Veggie {
#[doc = r" </details>"]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, ExtraDerive)]
pub struct Veggies {
#[serde(default, skip_serializing_if = "std::vec::Vec::is_empty")]
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub fruits: ::std::vec::Vec<::std::string::String>,
#[serde(default, skip_serializing_if = "std::vec::Vec::is_empty")]
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl From<&Veggies> for Veggies {
Expand Down
4 changes: 2 additions & 2 deletions cargo-typify/tests/outputs/multi_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ impl From<&Veggie> for Veggie {
:: serde :: Deserialize, :: serde :: Serialize, AnotherDerive, Clone, Debug, ExtraDerive,
)]
pub struct Veggies {
#[serde(default, skip_serializing_if = "std::vec::Vec::is_empty")]
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub fruits: ::std::vec::Vec<::std::string::String>,
#[serde(default, skip_serializing_if = "std::vec::Vec::is_empty")]
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl From<&Veggies> for Veggies {
Expand Down
4 changes: 2 additions & 2 deletions cargo-typify/tests/outputs/no-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ impl From<&Veggie> for Veggie {
#[doc = r" </details>"]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
pub struct Veggies {
#[serde(default, skip_serializing_if = "std::vec::Vec::is_empty")]
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub fruits: ::std::vec::Vec<::std::string::String>,
#[serde(default, skip_serializing_if = "std::vec::Vec::is_empty")]
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub vegetables: ::std::vec::Vec<Veggie>,
}
impl From<&Veggies> for Veggies {
Expand Down
4 changes: 2 additions & 2 deletions typify-impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ schemars = "0.8.21"
semver = "1.0.23"
serde = "1.0.215"
serde_json = "1.0.133"
syn = { version = "2.0.89", features = ["full", "visit-mut"] }
syn = { version = "2.0.89", features = ["full"] }
thiserror = "2.0.3"
unicode-ident = "1.0.14"

Expand All @@ -29,5 +29,5 @@ paste = "1.0.15"
rustfmt-wrapper = "0.2.1"
schema = "0.1.0"
schemars = { version = "0.8.21", features = ["uuid1", "impl_json_schema"] }
syn = { version = "2.0.89", features = ["full", "extra-traits"] }
syn = { version = "2.0.89", features = ["full", "extra-traits", "visit-mut"] }
uuid = "1.11.0"
4 changes: 2 additions & 2 deletions typify-impl/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,12 @@ pub(crate) fn generate_serde_attr(
let default_fn = match (state, &prop_type.details) {
(StructPropertyState::Optional, TypeEntryDetails::Option(_)) => {
serde_options.push(quote! { default });
serde_options.push(quote! { skip_serializing_if = "std::option::Option::is_none" });
serde_options.push(quote! { skip_serializing_if = "::std::option::Option::is_none" });
DefaultFunction::Default
}
(StructPropertyState::Optional, TypeEntryDetails::Vec(_)) => {
serde_options.push(quote! { default });
serde_options.push(quote! { skip_serializing_if = "std::vec::Vec::is_empty" });
serde_options.push(quote! { skip_serializing_if = "::std::vec::Vec::is_empty" });
DefaultFunction::Default
}
(StructPropertyState::Optional, TypeEntryDetails::Map(key_id, value_id)) => {
Expand Down
2 changes: 1 addition & 1 deletion typify-impl/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::{any::type_name, collections::HashSet};

use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use quote::ToTokens;
use rustfmt_wrapper::rustfmt;
use schema::Schema;
use schemars::{schema_for, JsonSchema};
Expand Down
1,646 changes: 823 additions & 823 deletions typify-impl/tests/github.out

Large diffs are not rendered by default.

Loading

0 comments on commit 4bfc9ac

Please sign in to comment.