]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unicode.fixed
Auto merge of #102536 - scottmcm:lookup_line-tweak, r=jackh726
[rust.git] / src / tools / clippy / tests / ui / unicode.fixed
1 // run-rustfix
2 // compile-flags: --test
3 #![allow(dead_code)]
4
5 #[warn(clippy::invisible_characters)]
6 fn 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)]
16 fn canon() {
17     print!("̀àh?");
18     print!("a\u{0300}h?"); // also ok
19 }
20
21 mod 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         }
49
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     }
55 }
56
57 fn main() {
58     zero();
59     canon();
60 }