RS.CLIPPY.NEEDLESS_RAW_STRINGS

Suggests using a string literal when a raw string literal is unnecessary

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_strings. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for raw string literals where a string literal can be used instead.

Why restrict this?

For consistent style by using simpler string literals whenever possible.

However, there are many cases where using a raw string literal is more idiomatic than a string literal, so it's opt-in.

Example

let r = r"Hello, world!";

Use instead:

let r = "Hello, world!";