Fix multiple field enum tokens (#1988)

A small change so that enums with multiple fields are comma seperated.
This commit is contained in:
mc1098 2021-08-04 19:44:21 +01:00 committed by GitHub
parent 47550292d5
commit 5ea6aec804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -119,7 +119,7 @@ impl Routable {
//named fields have idents
it.ident.as_ref().unwrap()
});
quote! { Self::#ident { #(#fields: params.get(stringify!(#fields))?.parse().ok()?)*, } }
quote! { Self::#ident { #(#fields: params.get(stringify!(#fields))?.parse().ok()?,)* } }
}
Fields::Unnamed(_) => unreachable!(), // already checked
};

View File

@ -6,6 +6,8 @@ enum Routes {
One,
#[at("/two/:id")]
Two { id: u32 },
#[at("/:a/:b")]
Three { a: u32, b: u32 },
#[at("/404")]
#[not_found]
NotFound,