feat(rust): add trailing comma support to route macro
#[macro_export]
/// Create a route
macro_rules! route {
- () => (
- crate::Route::from(crate::Route::new())
- );
- ($($x:expr),+) => ({
- let mut r = crate::Route::new();
+ ($($x:expr),* $(,)?) => ({
+ #[allow(unused_mut)]
+ let mut r = $crate::Route::new();
$(r = r.append($x);)*
- crate::Route::from(r)
+ $crate::Route::from(r)
});
}
@@ -27,4 +25,9 @@ mod tests {
let address: Address = random();
let _route = route!["str", "STR2", "STR3".to_string(), address];
}
+
+ #[test]
+ fn test3() {
+ let _route = route!["str",];
+ }
}
