From 7ef964b0a0e01c1967ed27de8f1b3584ce9ef6fb Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 4 May 2020 00:27:14 +0200 Subject: [PATCH] fix --- gotham_restful/src/openapi/builder.rs | 1 + gotham_restful/src/result/mod.rs | 2 +- gotham_restful_derive/src/from_body.rs | 2 +- gotham_restful_derive/src/resource_error.rs | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gotham_restful/src/openapi/builder.rs b/gotham_restful/src/openapi/builder.rs index 6c3d12b..0ca4cb1 100644 --- a/gotham_restful/src/openapi/builder.rs +++ b/gotham_restful/src/openapi/builder.rs @@ -14,6 +14,7 @@ pub struct OpenapiInfo pub urls : Vec } +#[derive(Debug)] pub struct OpenapiBuilder { pub openapi : Arc> diff --git a/gotham_restful/src/result/mod.rs b/gotham_restful/src/result/mod.rs index 547ae42..314b9ac 100644 --- a/gotham_restful/src/result/mod.rs +++ b/gotham_restful/src/result/mod.rs @@ -20,7 +20,7 @@ pub use no_content::NoContent; mod raw; pub use raw::Raw; -//#[allow(clippy::module_inception)] +#[allow(clippy::module_inception)] mod result; pub use result::IntoResponseError; diff --git a/gotham_restful_derive/src/from_body.rs b/gotham_restful_derive/src/from_body.rs index 9b7aa38..b3247e7 100644 --- a/gotham_restful_derive/src/from_body.rs +++ b/gotham_restful_derive/src/from_body.rs @@ -40,7 +40,7 @@ impl ParsedFields where I : Iterator { - let fields = fields.into_iter().enumerate().map(|(i, field)| (format_ident!("arg{}", i), field.ty)).collect(); + let fields = fields.enumerate().map(|(i, field)| (format_ident!("arg{}", i), field.ty)).collect(); Ok(Self { fields, named: false }) } diff --git a/gotham_restful_derive/src/resource_error.rs b/gotham_restful_derive/src/resource_error.rs index 2d4c341..7ebc738 100644 --- a/gotham_restful_derive/src/resource_error.rs +++ b/gotham_restful_derive/src/resource_error.rs @@ -150,7 +150,7 @@ impl ErrorVariant // the status might be relative to StatusCode, so let's fix that if status.leading_colon.is_none() && status.segments.len() < 2 { - let status_ident = status.segments.first().map(|path| path.clone()).unwrap_or_else(|| path_segment("OK")); + let status_ident = status.segments.first().cloned().unwrap_or_else(|| path_segment("OK")); Path { leading_colon: Some(Default::default()), segments: vec![path_segment("gotham_restful"), path_segment("gotham"), path_segment("hyper"), path_segment("StatusCode"), status_ident].into_iter().collect() @@ -199,7 +199,7 @@ fn expand(tokens : TokenStream) -> Result Data::Union(uni) => Err(uni.union_token.span()) }.map_err(|span| Error::new(span, "#[derive(ResourceError)] only works for enums"))?; let variants = inum.variants.into_iter() - .map(|variant| process_variant(variant)) + .map(process_variant) .collect_to_result()?; let display_impl = if variants.iter().any(|v| v.display.is_none()) { None } else {