Skip to content

string_lit_as_bytes gives incorrect recommendation with stringify!() #763

Closed
@ipetkov

Description

@ipetkov

Sample program:

#![feature(plugin)]
#![plugin(clippy)]

fn main() {
    let _ = bstringify!(foo).as_bytes();
}

Warning given:

calling as_bytes() on a string literal. Consider using a byte string literal instead: bstringify!(foo), #[warn(string_lit_as_bytes)] on by default

Of course, using bstringify!(foo) gives an undefined macro error from rustc.

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