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

Lint against format_implicit_args #5404

Open
dylni opened this issue Apr 2, 2020 · 6 comments
Open

Lint against format_implicit_args #5404

dylni opened this issue Apr 2, 2020 · 6 comments
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. L-restriction Lint: Belongs in the restriction lint group T-macros Type: Issues with macros and macro expansion

Comments

@dylni
Copy link

dylni commented Apr 2, 2020

Would you consider a lint to warn for uses of the "format_implicit_args" feature now that rust-lang/rfcs#2795 has been merged?

As far as I'm aware, it's the only way the standard library provides for a string to be interpreted as a variable. It can be done using procedural macros, but that would require adding a crate as a dependency. So, I would prefer a lint against this, because I believe it to be an anti-pattern.

@flip1995
Copy link
Member

flip1995 commented Apr 2, 2020

You mean a lint, that fires on every use of implicit args?

@dylni
Copy link
Author

dylni commented Apr 2, 2020

Yes. If clippy stops after the first usage, that would work too, but I haven't found that to be how lints typically behave.

@flip1995
Copy link
Member

flip1995 commented Apr 2, 2020

This would be linting on a whole feature, that got accepted through an RFC, which Clippy normally doesn't do.

But Clippy has the restriction lint group, where such a lint would be possible, but then has to be enabled explicitly. This lint would first require this feature to be implemented in rustc though.

@flip1995 flip1995 added A-lint Area: New lints S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work T-macros Type: Issues with macros and macro expansion labels Apr 2, 2020
@dylni
Copy link
Author

dylni commented Apr 2, 2020

The restriction group definitely makes the most sense.

I figured it would need to be implemented in rustc first, but I wanted to create the issue now to see if this would even be considered with the RFC being accepted. There was some opposition on the RFC though, which also showed in the voting, so I think this could be generally useful.

@camsteffen camsteffen added L-restriction Lint: Belongs in the restriction lint group E-medium Call for participation: Medium difficulty level problem and requires some initial experience. and removed S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work labels Feb 7, 2021
@MightyPork
Copy link

I would actually be interested in the opposite lint of the proposal here, a lint warning about the old syntax in format macros. It could even have automatic fix available.

@dylni
Copy link
Author

dylni commented May 9, 2022

This could be similar to implicit_return and needless_return, which both exist for both styles.

Also, this issue can now be unblocked.

@rustbot labels: -S-blocked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. L-restriction Lint: Belongs in the restriction lint group T-macros Type: Issues with macros and macro expansion
Projects
None yet
Development

No branches or pull requests

4 participants