Skip to content

Commit

Permalink
Clean up imports for utoipa-gen
Browse files Browse the repository at this point in the history
  • Loading branch information
juhaku committed May 15, 2024
1 parent 7563a72 commit 5530d29
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
2 changes: 2 additions & 0 deletions utoipa-gen/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,14 @@ pub struct ResolvedOperation {
pub body: String,
}

#[allow(unused)]
pub type Arguments<'a> = (
Option<Vec<ValueArgument<'a>>>,
Option<Vec<IntoParamsType<'a>>>,
Option<RequestBody<'a>>,
);

#[allow(unused)]
pub trait ArgumentResolver {
fn resolve_arguments(
_: &'_ Punctuated<syn::FnArg, Comma>,
Expand Down
13 changes: 3 additions & 10 deletions utoipa-gen/src/ext/actix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,16 @@ use crate::{

use super::{
fn_arg::{self, FnArg},
ArgumentIn, ArgumentResolver, MacroArg, MacroPath, PathOperationResolver, PathOperations,
PathResolver, ResolvedOperation, ValueArgument,
ArgumentIn, ArgumentResolver, Arguments, MacroArg, MacroPath, PathOperationResolver,
PathOperations, PathResolver, ResolvedOperation, ValueArgument,
};

impl ArgumentResolver for PathOperations {
fn resolve_arguments(
fn_args: &Punctuated<syn::FnArg, Comma>,
macro_args: Option<Vec<MacroArg>>,
_: String,
) -> Result<
(
Option<Vec<super::ValueArgument<'_>>>,
Option<Vec<super::IntoParamsType<'_>>>,
Option<super::RequestBody<'_>>,
),
Diagnostics,
> {
) -> Result<Arguments, Diagnostics> {
let (into_params_args, value_args): (Vec<FnArg>, Vec<FnArg>) =
fn_arg::get_fn_args(fn_args)?.partition(fn_arg::is_into_params);

Expand Down
2 changes: 1 addition & 1 deletion utoipa-gen/src/path/parameter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{borrow::Cow, fmt::Display};

use proc_macro2::{Ident, Span, TokenStream};
use proc_macro2::{Ident, TokenStream};
use quote::{quote, quote_spanned, ToTokens};
use syn::{
parenthesized,
Expand Down
5 changes: 1 addition & 4 deletions utoipa-gen/src/path/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ use syn::{
};

use crate::{
component::{
features::{impl_merge, Inline},
ComponentSchema, TypeTree,
},
component::{features::Inline, ComponentSchema, TypeTree},
impl_to_tokens_diagnostics, parse_utils, AnyValue, Array, Diagnostics,
};

Expand Down

0 comments on commit 5530d29

Please sign in to comment.