Skip to content

Commit c03fe21

Browse files
author
mc1098
committed
Fix multiple field enum tokens
A small change so that enums with multiple fields are comma seperated.
1 parent 4755029 commit c03fe21

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/yew-router-macro/src/routable_derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl Routable {
119119
//named fields have idents
120120
it.ident.as_ref().unwrap()
121121
});
122-
quote! { Self::#ident { #(#fields: params.get(stringify!(#fields))?.parse().ok()?)*, } }
122+
quote! { Self::#ident { #(#fields: params.get(stringify!(#fields))?.parse().ok()?,)* } }
123123
}
124124
Fields::Unnamed(_) => unreachable!(), // already checked
125125
};

packages/yew-router-macro/tests/routable_derive/valid-pass.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ enum Routes {
66
One,
77
#[at("/two/:id")]
88
Two { id: u32 },
9+
#[at("/:a/:b")]
10+
Three { a: u32, b: u32 },
911
#[at("/404")]
1012
#[not_found]
1113
NotFound,

0 commit comments

Comments
 (0)