Skip to content

Commit

Permalink
Fix unused parameter warning
Browse files Browse the repository at this point in the history
Fix unused parameter warning if no actix_extras nor rocket_extras is present in active features.
  • Loading branch information
juhaku committed May 3, 2022
1 parent 374be13 commit 960637e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions utoipa-gen/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ impl ToTokens for Operation<'_> {
if let Some(parameters) = self.parameters {
parameters.iter().for_each(|parameter| match parameter {
Parameter::Value(_) => tokens.extend(quote! { .parameter(#parameter) }),
#[cfg(any(feature = "actix_extras", feature = "rocket_extras"))]
Parameter::TokenStream(_) => tokens.extend(quote! { .parameters(Some(#parameter))}),
});
}
Expand Down
2 changes: 2 additions & 0 deletions utoipa-gen/src/path/parameter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use super::property::Property;
#[cfg_attr(feature = "debug", derive(Debug))]
pub enum Parameter<'a> {
Value(ParameterValue<'a>),
#[cfg(any(feature = "actix_extras", feature = "rocket_extras"))]
TokenStream(TokenStream),
}

Expand Down Expand Up @@ -194,6 +195,7 @@ impl ToTokens for Parameter<'_> {

match self {
Parameter::Value(parameter) => handle_single_parameter(parameter),
#[cfg(any(feature = "actix_extras", feature = "rocket_extras"))]
Parameter::TokenStream(stream) => {
tokens.extend(quote! { #stream });
}
Expand Down

0 comments on commit 960637e

Please sign in to comment.