Skip to content

Use byte string instead of slice of byte characters #10147

@matthiasbeyer

Description

@matthiasbeyer

What it does

I accidentially used

let a = &[b'a', b'/', b'b'];

instead of

let a = b"a/b";

so I figured this could be a clippy lint.

Lint Name

bytestring_instead_of_byte_chars

Category

style

Advantage

  • Easier to read
  • Easier to change/extend

Drawbacks

None

Example

let a = &[b'a', b'/', b'b'];

Could be written as:

let a = b"a/b";

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