]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/unicode.fixed
New upstream version 1.65.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / unicode.fixed
CommitLineData
923072b8 1// run-rustfix
f2b60f7d
FG
2// compile-flags: --test
3#![allow(dead_code)]
4
923072b8
FG
5#[warn(clippy::invisible_characters)]
6fn zero() {
7 print!("Here >\u{200B}< is a ZWS, and \u{200B}another");
8 print!("This\u{200B}is\u{200B}fine");
9 print!("Here >\u{AD}< is a SHY, and \u{AD}another");
10 print!("This\u{ad}is\u{ad}fine");
11 print!("Here >\u{2060}< is a WJ, and \u{2060}another");
12 print!("This\u{2060}is\u{2060}fine");
13}
14
15#[warn(clippy::unicode_not_nfc)]
16fn canon() {
17 print!("̀àh?");
18 print!("a\u{0300}h?"); // also ok
19}
20
f2b60f7d
FG
21mod non_ascii_literal {
22 #![deny(clippy::non_ascii_literal)]
23
24 fn uni() {
25 print!("\u{dc}ben!");
26 print!("\u{DC}ben!"); // this is ok
27 }
28
29 // issue 8013
30 fn single_quote() {
31 const _EMPTY_BLOCK: char = '\u{25b1}';
32 const _FULL_BLOCK: char = '\u{25b0}';
33 }
34
35 #[test]
36 pub fn issue_7739() {
37 // Ryū crate: https://github.com/dtolnay/ryu
38 }
39
40 mod issue_8263 {
41 #![deny(clippy::non_ascii_literal)]
42
43 // Re-allow for a single test
44 #[test]
45 #[allow(clippy::non_ascii_literal)]
46 fn allowed() {
47 let _ = "悲しいかな、ここに日本語を書くことはできない。";
48 }
923072b8 49
f2b60f7d
FG
50 #[test]
51 fn denied() {
52 let _ = "\u{60b2}\u{3057}\u{3044}\u{304b}\u{306a}\u{3001}\u{3053}\u{3053}\u{306b}\u{65e5}\u{672c}\u{8a9e}\u{3092}\u{66f8}\u{304f}\u{3053}\u{3068}\u{306f}\u{3067}\u{304d}\u{306a}\u{3044}\u{3002}";
53 }
54 }
923072b8
FG
55}
56
57fn main() {
58 zero();
923072b8 59 canon();
923072b8 60}