Skip to content

Recommend const functions instead of static variables #2288

@clarfonthey

Description

@clarfonthey

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-styleLint: Belongs in the style lint groupT-middleType: Probably requires verifiying typesgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions