RS.CLIPPY.NON_ASCII_LITERAL

Using any literal non-ASCII chars in a string literal instead of using the `\\u` escape

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

What it does

Checks for non-ASCII characters in string and char literals.

Why restrict this?

Yeah, we know, the 90's called and wanted their charset back. Even so, there still are editors and other programs out there that don't work well with Unicode. So if the code is meant to be used internationally, on multiple operating systems, or has other portability requirements, activating this lint could be useful.

Example

let x = String::from("€");

Use instead:

let x = String::from("\\u{20ac}");