From 7502d851dc2318882d2a6d0425170fbca5667fd7 Mon Sep 17 00:00:00 2001 From: Juha Kukkonen Date: Tue, 22 Nov 2022 01:45:12 +0200 Subject: [PATCH] Clean unused dependencies related to repr feature --- utoipa-gen/Cargo.toml | 2 +- utoipa-gen/src/component/schema.rs | 20 +++++++++++--------- utoipa/Cargo.toml | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/utoipa-gen/Cargo.toml b/utoipa-gen/Cargo.toml index 4480b215..55b918f5 100644 --- a/utoipa-gen/Cargo.toml +++ b/utoipa-gen/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "utoipa-gen" description = "Code generation implementation for utoipa" -version = "2.4.0" +version = "2.4.1" edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/utoipa-gen/src/component/schema.rs b/utoipa-gen/src/component/schema.rs index de63a341..9bc8bb8f 100644 --- a/utoipa-gen/src/component/schema.rs +++ b/utoipa-gen/src/component/schema.rs @@ -5,19 +5,18 @@ use proc_macro_error::{abort, ResultExt}; use quote::{quote, quote_spanned, ToTokens}; use syn::{ parse::Parse, punctuated::Punctuated, spanned::Spanned, token::Comma, Attribute, Data, Field, - Fields, FieldsNamed, FieldsUnnamed, Generics, Path, PathArguments, Token, TypePath, Variant, - Visibility, + Fields, FieldsNamed, FieldsUnnamed, Generics, Path, PathArguments, Token, Variant, Visibility, }; use crate::{ - component::features::{Example, Rename}, + component::features::Rename, doc_comment::CommentAttributes, schema_type::{SchemaFormat, SchemaType}, Array, Deprecated, }; use self::{ - enum_variant::{CustomEnum, Enum, ObjectVariant, ReprVariant, SimpleEnumVariant, TaggedEnum}, + enum_variant::{CustomEnum, Enum, ObjectVariant, SimpleEnumVariant, TaggedEnum}, features::{ ComplexEnumFeatures, EnumFeatures, EnumNamedFieldVariantFeatures, EnumUnnamedFieldVariantFeatures, FromAttributes, NamedFieldFeatures, @@ -472,7 +471,7 @@ impl ToTokens for EnumSchema<'_> { .iter() .find_map(|attribute| { if attribute.path.is_ident("repr") { - attribute.parse_args::().ok() + attribute.parse_args::().ok() } else { None } @@ -561,7 +560,7 @@ impl ToTokens for EnumSchemaType<'_> { struct ReprEnum<'a> { variants: &'a Punctuated, attributes: &'a [Attribute], - enum_type: TypePath, + enum_type: syn::TypePath, } #[cfg(feature = "repr")] @@ -569,7 +568,10 @@ impl ToTokens for ReprEnum<'_> { fn to_tokens(&self, tokens: &mut TokenStream) { let container_rules = serde::parse_container(self.attributes); let repr_enum_features = features::parse_schema_features_with(self.attributes, |input| { - Ok(parse_features!(input as Example, super::features::Default)) + Ok(parse_features!( + input as super::features::Example, + super::features::Default + )) }) .unwrap_or_default(); @@ -582,7 +584,7 @@ impl ToTokens for ReprEnum<'_> { if is_not_skipped(&variant_rules) { let repr_type = &self.enum_type; - Some(ReprVariant { + Some(enum_variant::ReprVariant { value: quote! { Self::#variant_type as #repr_type }, type_path: repr_type, }) @@ -590,7 +592,7 @@ impl ToTokens for ReprEnum<'_> { None } }) - .collect::>>() + .collect::>>() }); } } diff --git a/utoipa/Cargo.toml b/utoipa/Cargo.toml index d7f09a06..0f70689a 100644 --- a/utoipa/Cargo.toml +++ b/utoipa/Cargo.toml @@ -38,7 +38,7 @@ repr = ["utoipa-gen/repr"] serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0", optional = true } serde_yaml = { version = "0.9", optional = true } -utoipa-gen = { version = "2.4.0", path = "../utoipa-gen" } +utoipa-gen = { version = "2.4.1", path = "../utoipa-gen" } indexmap = { version = "1", features = ["serde"] } [dev-dependencies]