Program does not compile, because the arm with 'b' doesn't have a trailing comma.
error: no rules expected the token `'f'`
--> src/main.rs:14:9
|
13 | }
| - help: missing comma here
14 | 'f' => success('\u{c}'),
| ^^^ no rules expected this token in macro call
|
= note: while trying to match sequence start
If you add a trailing comma after, it compiles:
'b' => {
success('\u{8}')
},
Expected Behaviour
dispatch! should work like Rust's standard match construct, which requires a trailing comma after non-{} arms, but allows omitting the trailing comma after {} arms.
This way dispatch! will be more familiar to new users of the library
Additional Context
This is a very minor low-priority issue, but the current macro behaviour surprised me. I figured it was worth tracking.
Please complete the following tasks
rust version
1.73
winnow version
0.5.16
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo check
Actual Behaviour
Program does not compile, because the arm with 'b' doesn't have a trailing comma.
If you add a trailing comma after, it compiles:
Expected Behaviour
dispatch! should work like Rust's standard
match
construct, which requires a trailing comma after non-{} arms, but allows omitting the trailing comma after {} arms.This way dispatch! will be more familiar to new users of the library
Additional Context
This is a very minor low-priority issue, but the current macro behaviour surprised me. I figured it was worth tracking.