Skip to content

Wrong suggestion for string_lit_as_bytes lint #3205

Closed
@jonasbb

Description

@jonasbb

Error Message:

warning: calling `as_bytes()` on a string literal
  --> plot/src/lib.rs:40:25
   |
40 |         stdin.write_all(include_str!("./percentage_stacked_area_chart.py").as_bytes())?;
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a byte string literal instead: `binclude_str!("./percentage_stacked_area_chart.py")`
   |
   = note: #[warn(clippy::string_lit_as_bytes)] on by default
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#string_lit_as_bytes

stdin is the stdin handle of a child process which I want to communicate with.

The suggestion to use binclude_str! is wrong, as this macro does not exist. The correct solution would be to suggest include_bytes!.

Clippy version:
clippy 0.0.212 (125907a 2018-09-17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-styleLint: Belongs in the style lint groupL-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