Skip to content

Suggest to remove unneeded trailing comma #13965

Open
@nyurik

Description

@nyurik

What it does

In most cases, a trailing comma before parentheses is not needed, especially in a macro invocation. Yet, I suspect this cannot be fully automated by rustfmt because there are some edge cases which do require that comma to be present. I think there should be a lint offering to remove it.

Advantage

  • Cleaner, easier to read code

Drawbacks

extremely rare edge cases might be tricky to detect

Example

debug!("Foo={}", 1,);

Could be written as:

debug!("Foo={}", 1);

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions