]> git.lizzy.rs Git - rust.git/blob - src/docs/non_ascii_literal.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / non_ascii_literal.txt
1 ### What it does
2 Checks for non-ASCII characters in string and char literals.
3
4 ### Why is this bad?
5 Yeah, we know, the 90's called and wanted their charset
6 back. Even so, there still are editors and other programs out there that
7 don't work well with Unicode. So if the code is meant to be used
8 internationally, on multiple operating systems, or has other portability
9 requirements, activating this lint could be useful.
10
11 ### Example
12 ```
13 let x = String::from("€");
14 ```
15
16 Use instead:
17 ```
18 let x = String::from("\u{20ac}");
19 ```