Skip to content

Commit aaddc14

Browse files
author
Alexander Clarke
committed
Small improvements to the example
1 parent 3104870 commit aaddc14

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/flow_control/match/destructuring/destructure_structures.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ fn main() {
1313
let foo = Foo { x: (1, 2), y: 3 };
1414
1515
match foo {
16-
Foo { x: (1, b), y } => println!("a = 1, b = {}, y = {} ", b, y),
16+
Foo { x: (1, b), y } => println!("First of x is 1, b = {}, y = {} ", b, y),
1717
1818
// you can destructure structs and rename the variables,
1919
// the order is not important
20-
Foo { y: 2, x: i } => println!("i = {:?}, j = 2", i),
20+
Foo { y: 2, x: i } => println!("y is 2, i = {:?}", i),
2121
2222
// and you can also ignore some variables:
23-
Foo { y, .. } => println!("y = {}", y),
23+
Foo { y, .. } => println!("y = {}, we don't care about x", y),
2424
// this will give an error: pattern does not mention field `x`
2525
//Foo { y } => println!("y = {}", y);
2626
}

0 commit comments

Comments
 (0)