about summary refs log tree commit diff
path: root/compiler/rustc_lexer/src
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-02-08 22:12:13 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-02-08 22:12:13 +0000
commit1fcae03369abb4c2cc180cd5a49e1f4440a81300 (patch)
treefe705ff77c286f5fc4c09acc98d2f124086d0479 /compiler/rustc_lexer/src
parent3183b44a1ec209b06e0c26cbc92217176b59dc76 (diff)
downloadrust-1fcae03369abb4c2cc180cd5a49e1f4440a81300.tar.gz
rust-1fcae03369abb4c2cc180cd5a49e1f4440a81300.zip
Rustfmt
Diffstat (limited to 'compiler/rustc_lexer/src')
-rw-r--r--compiler/rustc_lexer/src/tests.rs35
-rw-r--r--compiler/rustc_lexer/src/unescape/tests.rs15
2 files changed, 34 insertions, 16 deletions
diff --git a/compiler/rustc_lexer/src/tests.rs b/compiler/rustc_lexer/src/tests.rs
index db7225fc2a8..8203ae70b07 100644
--- a/compiler/rustc_lexer/src/tests.rs
+++ b/compiler/rustc_lexer/src/tests.rs
@@ -131,7 +131,9 @@ fn check_lexing(src: &str, expect: Expect) {
 
 #[test]
 fn smoke_test() {
-    check_lexing("/* my source file */ fn main() { println!(\"zebra\"); }\n", expect![[r#"
+    check_lexing(
+        "/* my source file */ fn main() { println!(\"zebra\"); }\n",
+        expect![[r#"
             Token { kind: BlockComment { doc_style: None, terminated: true }, len: 20 }
             Token { kind: Whitespace, len: 1 }
             Token { kind: Ident, len: 2 }
@@ -151,7 +153,8 @@ fn smoke_test() {
             Token { kind: Whitespace, len: 1 }
             Token { kind: CloseBrace, len: 1 }
             Token { kind: Whitespace, len: 1 }
-        "#]])
+        "#]],
+    )
 }
 
 #[test]
@@ -194,35 +197,47 @@ fn comment_flavors() {
 
 #[test]
 fn nested_block_comments() {
-    check_lexing("/* /* */ */'a'", expect![[r#"
+    check_lexing(
+        "/* /* */ */'a'",
+        expect![[r#"
             Token { kind: BlockComment { doc_style: None, terminated: true }, len: 11 }
             Token { kind: Literal { kind: Char { terminated: true }, suffix_start: 3 }, len: 3 }
-        "#]])
+        "#]],
+    )
 }
 
 #[test]
 fn characters() {
-    check_lexing("'a' ' ' '\\n'", expect![[r#"
+    check_lexing(
+        "'a' ' ' '\\n'",
+        expect![[r#"
             Token { kind: Literal { kind: Char { terminated: true }, suffix_start: 3 }, len: 3 }
             Token { kind: Whitespace, len: 1 }
             Token { kind: Literal { kind: Char { terminated: true }, suffix_start: 3 }, len: 3 }
             Token { kind: Whitespace, len: 1 }
             Token { kind: Literal { kind: Char { terminated: true }, suffix_start: 4 }, len: 4 }
-        "#]]);
+        "#]],
+    );
 }
 
 #[test]
 fn lifetime() {
-    check_lexing("'abc", expect![[r#"
+    check_lexing(
+        "'abc",
+        expect![[r#"
             Token { kind: Lifetime { starts_with_number: false }, len: 4 }
-        "#]]);
+        "#]],
+    );
 }
 
 #[test]
 fn raw_string() {
-    check_lexing("r###\"\"#a\\b\x00c\"\"###", expect![[r#"
+    check_lexing(
+        "r###\"\"#a\\b\x00c\"\"###",
+        expect![[r#"
             Token { kind: Literal { kind: RawStr { n_hashes: Some(3) }, suffix_start: 17 }, len: 17 }
-        "#]])
+        "#]],
+    )
 }
 
 #[test]
diff --git a/compiler/rustc_lexer/src/unescape/tests.rs b/compiler/rustc_lexer/src/unescape/tests.rs
index 6fa7a150516..5b99495f475 100644
--- a/compiler/rustc_lexer/src/unescape/tests.rs
+++ b/compiler/rustc_lexer/src/unescape/tests.rs
@@ -108,12 +108,15 @@ fn test_unescape_str_warn() {
     check("\\\n", &[]);
     check("\\\n ", &[]);
 
-    check("\\\n \u{a0} x", &[
-        (0..5, Err(EscapeError::UnskippedWhitespaceWarning)),
-        (3..5, Ok('\u{a0}')),
-        (5..6, Ok(' ')),
-        (6..7, Ok('x')),
-    ]);
+    check(
+        "\\\n \u{a0} x",
+        &[
+            (0..5, Err(EscapeError::UnskippedWhitespaceWarning)),
+            (3..5, Ok('\u{a0}')),
+            (5..6, Ok(' ')),
+            (6..7, Ok('x')),
+        ],
+    );
     check("\\\n  \n  x", &[(0..7, Err(EscapeError::MultipleSkippedLinesWarning)), (7..8, Ok('x'))]);
 }