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

Recommend const functions instead of static variables #2288

Closed
clarfonthey opened this issue Dec 22, 2017 · 0 comments
Closed

Recommend const functions instead of static variables #2288

clarfonthey opened this issue Dec 22, 2017 · 0 comments
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-style Lint: Belongs in the style lint group T-middle Type: Probably requires verifiying types

Comments

@clarfonthey
Copy link
Contributor

clarfonthey commented Dec 22, 2017

Now that const fn invocation is stabilised for the standard library at least, it makes sense to suggest replacing static variables with their const equivalents, namely:

  • ATOMIC_X_INIT => AtomicX::new(0)
  • ONCE_INIT => Once::new()
  • uX/iX::MAX/MIN => uX/iX::max/min_value()
@oli-obk oli-obk added L-style Lint: Belongs in the style lint group good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints T-middle Type: Probably requires verifiying types labels Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-style Lint: Belongs in the style lint group T-middle Type: Probably requires verifiying types
Projects
None yet
Development

No branches or pull requests

2 participants