]> git.proxmox.com Git - rustc.git/blobdiff - src/doc/book/patterns.md
New upstream version 1.12.0+dfsg1
[rustc.git] / src / doc / book / patterns.md
index a0245d4c7b163f724157366db677946dbdd1d8f3..910b13754767facc46acd73885ae9ba02ef73fd1 100644 (file)
@@ -109,14 +109,14 @@ struct Point {
     y: i32,
 }
 
-let origin = Point { x: 0, y: 0 };
+let point = Point { x: 2, y: 3 };
 
-match origin {
+match point {
     Point { x, .. } => println!("x is {}", x),
 }
 ```
 
-This prints `x is 0`.
+This prints `x is 2`.
 
 You can do this kind of match on any member, not only the first:
 
@@ -126,14 +126,14 @@ struct Point {
     y: i32,
 }
 
-let origin = Point { x: 0, y: 0 };
+let point = Point { x: 2, y: 3 };
 
-match origin {
+match point {
     Point { y, .. } => println!("y is {}", y),
 }
 ```
 
-This prints `y is 0`.
+This prints `y is 3`.
 
 This â€˜destructuring’ behavior works on any compound data type, like
 [tuples][tuples] or [enums][enums].