Skip to content

clippy::useless_format ignores format!("") #7796

@klensy

Description

@klensy

Lint name: clippy::useless_format

I tried this code:

pub fn foo()->String{
    format!("")
}

I expected to see this happen:
Warning from clippy about useless format! call, similar to:

warning: useless use of `format!`
 --> src/main.rs:6:5
  |
6 |     format!("")
  |     ^^^^^^^^^^^ help: consider using `.to_string()`: `"".to_string()`

Instead, this happened:
No warning.

Meta

Rust version (rustc -Vv):

rustc 1.57.0-nightly (54bb4fec6 2021-10-08)
binary: rustc
commit-hash: 54bb4fec68cb592e23077896baea072919721573
commit-date: 2021-10-08
host: x86_64-pc-windows-msvc
release: 1.57.0-nightly
LLVM version: 13.0.0

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions