RS.CLIPPY.NEEDLESS_RAW_STRING_HASHES

Suggests reducing the number of hashes around a raw string literal

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: needless_raw_string_hashes. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for raw string literals with an unnecessary amount of hashes around them.

Why is this bad?

It's just unnecessary, and makes it look like there's more escaping needed than is actually necessary.

Example

let r = r###"Hello, "world"!"###;

Use instead:

let r = r#"Hello, "world"!"#;

Configuration

  • allow-one-hash-in-raw-strings: Whether to allow r#""# when r"" can be used

    (default: false)