Skip to content

Warn against using legacy std integral constants #10995

Closed

Description

What it does

This lint triggers on usage of legacy integral constants and functions, such as:

  • std::i32::MAX
  • u64::max_value()

Advantage

Enforce a consistent style across the ecosystem.

This lint should probably be placed into the clippy::style group.

Drawbacks

Older projects will experience some churn, but this should be trivially auto-fixable in most cases.

T-libs-api opposes deprecating this outright so a clippy lint is the next best thing.

Example

if x == std::i32::MAX {

Could be written using the associated constant as:

if x == i32::MAX {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    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