From dbd1a09031714bda7be972ea14686f44d8cbe451 Mon Sep 17 00:00:00 2001 From: Nicole L Date: Fri, 16 May 2025 14:10:30 -0700 Subject: [PATCH] Reorder struct pattern examples (#2749) I generally like to start with that second case since imo it's the simplest one before going on to the case that uses a tuple sub-pattern to break up the `x` field. --- third_party/rust-by-example/destructuring-structs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/rust-by-example/destructuring-structs.rs b/third_party/rust-by-example/destructuring-structs.rs index 012588d2..21636e42 100644 --- a/third_party/rust-by-example/destructuring-structs.rs +++ b/third_party/rust-by-example/destructuring-structs.rs @@ -7,8 +7,8 @@ struct Foo { fn main() { let foo = Foo { x: (1, 2), y: 3 }; match foo { - Foo { x: (1, b), y } => println!("x.0 = 1, b = {b}, y = {y}"), Foo { y: 2, x: i } => println!("y = 2, x = {i:?}"), + Foo { x: (1, b), y } => println!("x.0 = 1, b = {b}, y = {y}"), Foo { y, .. } => println!("y = {y}, other fields were ignored"), } }