Skip to content

False positive: print_literal and env! #2657

Closed
@bjgill

Description

@bjgill

Found with clippy 0.0.193

warning: printing a literal with an empty format string
  --> src/bin/rm/main.rs:92:41
   |
92 |         println!("cargo-rm version {}", env!("CARGO_PKG_VERSION"));
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(print_literal)] on by default
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.193/index.html#print_literal

I'm fairly certain that there isn't a way to shorten this as the docs suggest.

It looks as if this was discussed in #2617 and #2608. Whilst it's true that println!(env!("FOO")) is better than println!("{}", env!("FOO")), I don't think there is an equivalent for println!("bar: {}", env!("FOO")).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingT-macrosType: Issues with macros and macro expansion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions