about summary refs log tree commit diff
path: root/src/tools/rustfmt/tests
diff options
context:
space:
mode:
authorLaurențiu Nicola <lnicola@users.noreply.github.com>2025-05-01 07:33:30 +0000
committerGitHub <noreply@github.com>2025-05-01 07:33:30 +0000
commit00d2f60efd516bc7ea658bd0a6de5e2f1f1df322 (patch)
tree9375885343e27ab26b20dfe5a3714e00d5d378d0 /src/tools/rustfmt/tests
parente7502210ce5ab2d92cb87c372dab51b637ba6df4 (diff)
parent1c5de64814d72effc6890ca823fa4d248041a0bd (diff)
downloadrust-00d2f60efd516bc7ea658bd0a6de5e2f1f1df322.tar.gz
rust-00d2f60efd516bc7ea658bd0a6de5e2f1f1df322.zip
Merge pull request #19726 from lnicola/sync-from-rust
Sync from downstream again
Diffstat (limited to 'src/tools/rustfmt/tests')
-rw-r--r--src/tools/rustfmt/tests/source/let_chains.rs10
-rw-r--r--src/tools/rustfmt/tests/target/let_chains.rs8
2 files changed, 8 insertions, 10 deletions
diff --git a/src/tools/rustfmt/tests/source/let_chains.rs b/src/tools/rustfmt/tests/source/let_chains.rs
index b7c1f811096..0c4d8aa85ea 100644
--- a/src/tools/rustfmt/tests/source/let_chains.rs
+++ b/src/tools/rustfmt/tests/source/let_chains.rs
@@ -20,6 +20,11 @@ fn test_single_line_let_chain() {
     if a && let Some(b) = foo() {
     }
 
+    // first item in let-chain is a bool literal
+    if true && let Some(x) = y {
+
+    }
+
     // first item in let-chain is a unary ! with an ident
     let unary_not = if !from_hir_call
         && let Some(p) = parent
@@ -94,11 +99,6 @@ fn test_multi_line_let_chain() {
 
     }
 
-    // bool literal
-    if true && let Some(x) = y {
-
-    }
-
     // cast to a bool
     if 1 as bool && let Some(x) = y {
 
diff --git a/src/tools/rustfmt/tests/target/let_chains.rs b/src/tools/rustfmt/tests/target/let_chains.rs
index 1ceecac8abc..204937b4cac 100644
--- a/src/tools/rustfmt/tests/target/let_chains.rs
+++ b/src/tools/rustfmt/tests/target/let_chains.rs
@@ -50,6 +50,9 @@ fn test_single_line_let_chain() {
     // first item in let-chain is an ident
     if a && let Some(b) = foo() {}
 
+    // first item in let-chain is a bool literal
+    if true && let Some(x) = y {}
+
     // first item in let-chain is a unary ! with an ident
     let unary_not = if !from_hir_call && let Some(p) = parent {};
 
@@ -102,11 +105,6 @@ fn test_multi_line_let_chain() {
         && let Some(x) = y
     {}
 
-    // bool literal
-    if true
-        && let Some(x) = y
-    {}
-
     // cast to a bool
     if 1 as bool
         && let Some(x) = y