Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
This commit is contained in:
Erik Johnston 2021-02-24 11:51:30 +00:00 committed by GitHub
parent f78b219856
commit 16d21906df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -229,10 +229,9 @@ impl Route {
// //
// Note that multi line doc comments are converted to multiple doc // Note that multi line doc comments are converted to multiple doc
// attributes. // attributes.
let mut doc_attribute = Vec::new(); let mut doc_attributes = Vec::new();
for attr in &ast.attrs { for attr in &ast.attrs {
if let Some(ident) = attr.path.get_ident() { if attr.path.get_ident().is_ident("doc") {
if ident == "doc" {
doc_attribute.push(attr.clone()); doc_attribute.push(attr.clone());
} }
} }
@ -283,7 +282,7 @@ impl ToTokens for Route {
methods, methods,
}, },
resource_type, resource_type,
doc_attributes: doc_attribute, doc_attributes,
} = self; } = self;
let resource_name = name.to_string(); let resource_name = name.to_string();
let method_guards = { let method_guards = {
@ -311,7 +310,7 @@ impl ToTokens for Route {
.collect(); .collect();
let stream = quote! { let stream = quote! {
#doc_comment_token_stream #(#doc_comments)*
#[allow(non_camel_case_types, missing_docs)] #[allow(non_camel_case_types, missing_docs)]
pub struct #name; pub struct #name;