-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support trailing commas in lint_array #47428
Comments
Basically just change this macro to recognize and discard the trailing comma. Lines 98 to 105 in adc9d86
|
That macro declaration is formatted in a weird way. But anyway it should be enough to add |
How about this: macro_rules! lint_array {
($( $lint:expr ),*,) => { lint_array!( $( &$lint ),* ) };
($( $lint:expr ),*) => {{
static ARRAY: LintArray = &[ $( &$lint ),* ];
ARRAY
}}
} |
Out of curiosity, why doesn't rust allow trailing commas after |
The extra rule is fine too. It's just more annoying (extra repetition). And
there's no technical reason not to support one-or-none patterns as far as
I'm aware.
…On Sun, Jan 14, 2018 at 10:47 PM, Who? Me?! ***@***.***> wrote:
Out of curiosity, why doesn't rust allow trailing commas after $(pat),*
automatically? Does it make it hard to write some macros? Alternately, why
isn't there a ? (optional) repetition specification (e.g. $(pat)? would
be 0 or 1 times)?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#47428 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n34JOkRf6pQsXcniOmsnEFCSZw7eks5tKspjgaJpZM4RdrQH>
.
|
Made a PR :) |
Allow a trailing comma in lint_array fix rust-lang#47428
Allow a trailing comma in lint_array fix rust-lang#47428
rust-lang/rust-clippy#2350 (comment)
The text was updated successfully, but these errors were encountered: