Skip to content

Unnecessary unwrap_unchecked #11108

@Nugine

Description

@Nugine

What it does

Detects:

std::str::from_utf8(s).unwrap_unchecked()

Suggests:

std::str::from_utf8_unchecked(s)

Advantage

  • Skip the validation since the code doesn't need it
  • Suggest the more idiomatic method

Drawbacks

No response

Example

Detects:

std::str::from_utf8(s).unwrap_unchecked()

Suggests:

std::str::from_utf8_unchecked(s)

Metadata

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