Skip to content
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

Removed superfluous comma #28376

Closed
wants to merge 1 commit into from
Closed

Removed superfluous comma #28376

wants to merge 1 commit into from

Conversation

perlun
Copy link

@perlun perlun commented Sep 12, 2015

This must be a mistake, no?

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@killercup
Copy link
Member

It's correct, in fact. You can have trailing commas on the last item in structs and enums. This can be helpful when adding new items -- you only have you add one line, not edit one, too. This makes diffs nicer.

@steveklabnik
Copy link
Member

yes, and this is in fact considered good style. Rust will accept either.

Thank you for sending a PR though!

@perlun perlun deleted the patch-1 branch September 14, 2015 05:05
@perlun
Copy link
Author

perlun commented Sep 14, 2015

yes, and this is in fact considered good style. Rust will accept either.

Interesting. This is something that Rubocop complains about for Ruby code.

I can agree that it makes diffs nicer, but it makes the code uglier. 😉

Is there some tool similar to Rubocop for Rust btw? I mean, some form of basic linter/"best practices" checkup tool? And also, what are the agreed "best practices" for Rust? Is there something like Ruby style guide for Rust?

@killercup
Copy link
Member

There is this work-in-progress style guide:
http://doc.rust-lang.org/nightly/style/

I'm not sure there is a linter for style based issues yet. Some part are
default lints (e.g. snake case names for functions). There is rustfmt,
though, which might also fix dangling commas.

Per Lundberg notifications@github.com schrieb am Mo., 14. Sep. 2015 um
07:08:

yes, and this is in fact considered good style. Rust will accept either.

Interesting. This is something that Rubocop complains about
http://www.rubydoc.info/github/bbatsov/rubocop/Rubocop/Cop/Style/TrailingComma
for Ruby code.

I can agree that it makes diffs nicer, but it makes the code uglier. [image:
😉]

Is there some tool similar to Rubocop for Rust btw? I mean, some form of
basic linter/"best practices" checkup tool? And also, what are the
agreed "best practices" for Rust? Is there something like Ruby style guide
https://github.com/bbatsov/ruby-style-guide for Rust?


Reply to this email directly or view it on GitHub
#28376 (comment).

@perlun
Copy link
Author

perlun commented Oct 12, 2015

And for those wondering where rustfmt is, here be the link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants