1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-02-22 20:52:27 +00:00
This commit is contained in:
Dominic 2020-05-04 00:27:14 +02:00
parent 328ebf821e
commit 7ef964b0a0
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
4 changed files with 5 additions and 4 deletions

View file

@ -14,6 +14,7 @@ pub struct OpenapiInfo
pub urls : Vec<String>
}
#[derive(Debug)]
pub struct OpenapiBuilder
{
pub openapi : Arc<RwLock<OpenAPI>>

View file

@ -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;

View file

@ -40,7 +40,7 @@ impl ParsedFields
where
I : Iterator<Item = Field>
{
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 })
}

View file

@ -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<TokenStream2, Error>
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 {