-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
literal_string_with_formatting_args false positive on test #13885
Comments
Also just encountered this inside of pub fn bad() {
let value = 0;
assert!(format!("{value}").is_ascii());
} warning: this looks like a formatting argument but it is not part of a formatting macro
--> src/lib.rs:2:14
|
2 | let value = 0;
| ______________^
3 | | assert!(format!("{value}").is_ascii());
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#literal_string_with_formatting_args
= note: `#[warn(clippy::literal_string_with_formatting_args)]` on by default It looks like it tries to report the lint on a dummy span + some offset since in my original error it gets reported in lib.rs in some random comment at the top of the file. |
Got a few more examples This is an actix-web route
This is error_chain bail macro
In docs comment
Also appears on some imports with the
|
Might be a FN on |
@rustbot claim |
Ping @GuillaumeGomez |
More examples of false positives. Clippy doesn't like
I don't know whether it's the attribute or the import that's triggering it:
|
Just find another way to trigger the FP // file name: {value}.rs
#![crate_name = "strange_file_name"]
#![allow(unused)]
fn another_bad() {
let value = 0;
dbg!("something");
}
fn main() {} |
Wow nice. Gonna take a look in the next days. |
@profetia: I can't trigger the lint with your code. |
I opened #13953. |
@GuillaumeGomez You need to put it in a file that is named as |
another false positive in PyO3, on https://github.com/PyO3/pyo3/actions/runs/12680326895/job/35341906091?pr=4845#step:7:1086 |
I even see this hit on
|
Explanation in first comment of #13953. |
Not sure if the fix for this is in nightly or not. Still on the latest nightly I get the following issues
This is the warning generated
This is the warning
Same here
This is the warning
|
I think some of the warnings might not be covered by #13953. I'll check once merged. |
Summary
See reproducer below. I can't reproduce this in playground because it doesn't run clippy with
--all-targets
.Lint Name
literal_string_with_formatting_args
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No warnings.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: