fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.4 KiB58 linesraw
1#![allow(dead_code)]
2
3#[warn(clippy::invisible_characters)]
4fn zero() {
5    print!("Here >\u{200B}< is a ZWS, and \u{200B}another");
6    print!("This\u{200B}is\u{200B}fine");
7    print!("Here >\u{AD}< is a SHY, and \u{AD}another");
8    print!("This\u{ad}is\u{ad}fine");
9    print!("Here >\u{2060}< is a WJ, and \u{2060}another");
10    print!("This\u{2060}is\u{2060}fine");
11}
12
13#[warn(clippy::unicode_not_nfc)]
14fn canon() {
15    print!("̀àh?");
16    print!("a\u{0300}h?"); // also ok
17}
18
19mod non_ascii_literal {
20    #![deny(clippy::non_ascii_literal)]
21
22    fn uni() {
23        print!("\u{dc}ben!");
24        print!("\u{DC}ben!"); // this is ok
25    }
26
27    // issue 8013
28    fn single_quote() {
29        const _EMPTY_BLOCK: char = '\u{25b1}';
30        const _FULL_BLOCK: char = '\u{25b0}';
31    }
32
33    #[test]
34    pub fn issue_7739() {
35        // Ryū crate: https://github.com/dtolnay/ryu
36    }
37
38    mod issue_8263 {
39        #![deny(clippy::non_ascii_literal)]
40
41        // Re-allow for a single test
42        #[test]
43        #[allow(clippy::non_ascii_literal)]
44        fn allowed() {
45            let _ = "悲しいかな、ここに日本語を書くことはできない。";
46        }
47
48        #[test]
49        fn denied() {
50            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}";
51        }
52    }
53}
54
55fn main() {
56    zero();
57    canon();
58}