Skip to content

lint unnecessary literal casts #6116

@euclio

Description

@euclio

What it does

Lints unnecessary as-casts of literals when they could be written using literal syntax.

Categories (optional)

  • Kind: clippy::style

What is the advantage of the recommended code over the original code

  • Avoids accidental truncation
  • Uses syntax dedicated to this purpose

Drawbacks

None.

Example

1 as u32

Could be written as:

1u32

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-suggestionLint: Improving, adding or fixing lint suggestionsgood 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