rust-lang / rust-lang/rust-clippy
FP: needless_raw_string_hashes on inner empty raw string
Open
@shulaoda is already working on this.
Since Jul 26, 2026.
C-bug
I-false-positive
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
I have a situation where I'm including a raw string in a raw string... for testing, but I could also do this outside of a test.
Precisely, I have this:
let input = r##"task test(image: rust:latest, execute: "") {r#""#}"##;
check(input);
I have Pedantic lints enabled, and the empty raw string triggers the lint. If I add a space to the inner raw string; or any other character; the lint does not fire. i.e.
let input = r##"task test(image: rust:latest, execute: "") {r#"_"#}"##;
check(input);
Lint Name
needless_raw_string_hashes
Reproducer
I tried this code:
let input = r##"task test(image: rust:latest, execute: "") {r#""#}"##;
check(input);
I saw this happen:
|
73 | let input = r##"task test(image: rust, execute: "") {r#""#}"##;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `r#"task test(image: rust, execute: "") {r#""#}"#`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
= note: `-D clippy::needless-raw-string-hashes` implied by `-D warnings`
I expected to see this happen:
I do not expect the lint to trigger in this situation.
Version
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: aarch64-apple-darwin
release: 1.73.0
LLVM version: 17.0.2
Additional Labels
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.