Skip to content

string_lit_as_bytes lint isn't trigged when string contains escaped characters #4796

Closed
@upsuper

Description

@upsuper

I encountered a case where string_lit_as_bytes is not triggered as expected:

let bs = "a byte string\t\n".as_bytes();

If you remove \t\n, then it correctly suggests that it can use byte string literal instead, however, with either \t or \n presents, it doesn't say anything.

I'm testing using Clippy from playground which has version 0.0.212 (2019-10-28 c8e3cfb).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions