Skip to content

Commit 72c0275

Browse files
committed
reference: make tuple usage examples more meaningful
1 parent 912ab64 commit 72c0275

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/doc/reference.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,10 +3322,13 @@ An example of a tuple type and its use:
33223322

33233323
```
33243324
type Pair<'a> = (i32, &'a str);
3325-
let p: Pair<'static> = (10, "hello");
3325+
let p: Pair<'static> = (10, "ten");
33263326
let (a, b) = p;
3327-
assert!(b != "world");
3328-
assert!(p.0 == 10);
3327+
3328+
assert_eq!(a, 10);
3329+
assert_eq!(b, "ten");
3330+
assert_eq!(p.0, 10);
3331+
assert_eq!(p.1, "ten");
33293332
```
33303333

33313334
For historical reasons and convenience, the tuple type with no elements (`()`)

0 commit comments

Comments
 (0)