about summary refs log tree commit diff
path: root/compiler/rustc_lexer/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-22 19:05:04 -0400
committerMichael Goulet <michael@errs.io>2024-09-22 19:11:29 -0400
commitc682aa162b0d41e21cc6748f4fecfe01efb69d1f (patch)
tree0c31b640e3faacfb187a1509e3da5d5b6ba0109c /compiler/rustc_lexer/src
parent1173204b364841b51598744fc69d7c80be10f956 (diff)
downloadrust-c682aa162b0d41e21cc6748f4fecfe01efb69d1f.tar.gz
rust-c682aa162b0d41e21cc6748f4fecfe01efb69d1f.zip
Reformat using the new identifier sorting from rustfmt
Diffstat (limited to 'compiler/rustc_lexer/src')
-rw-r--r--compiler/rustc_lexer/src/tests.rs37
-rw-r--r--compiler/rustc_lexer/src/unescape/tests.rs15
2 files changed, 17 insertions, 35 deletions
diff --git a/compiler/rustc_lexer/src/tests.rs b/compiler/rustc_lexer/src/tests.rs
index 493ec2b0f60..556bbf1f518 100644
--- a/compiler/rustc_lexer/src/tests.rs
+++ b/compiler/rustc_lexer/src/tests.rs
@@ -1,4 +1,4 @@
-use expect_test::{expect, Expect};
+use expect_test::{Expect, expect};
 
 use super::*;
 
@@ -141,9 +141,7 @@ 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 }
@@ -163,8 +161,7 @@ fn smoke_test() {
             Token { kind: Whitespace, len: 1 }
             Token { kind: CloseBrace, len: 1 }
             Token { kind: Whitespace, len: 1 }
-        "#]],
-    )
+        "#]])
 }
 
 #[test]
@@ -207,47 +204,35 @@ 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 5b99495f475..6fa7a150516 100644
--- a/compiler/rustc_lexer/src/unescape/tests.rs
+++ b/compiler/rustc_lexer/src/unescape/tests.rs
@@ -108,15 +108,12 @@ 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'))]);
 }