Skip to content

Commit 3c47a16

Browse files
committed
update original
1 parent d821d8a commit 3c47a16

5 files changed

Lines changed: 11 additions & 5 deletions

File tree

rust-by-example/src/custom_types/enum/enum_use.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ enum Role {
1919
fn main() {
2020
// Explicitly `use` each name so they are available without
2121
// manual scoping.
22-
use crate::Stage::{Beginner, Advanced};
22+
use Stage::{Beginner, Advanced};
2323
// Automatically `use` each name inside `Role`.
24-
use crate::Role::*;
24+
use Role::*;
2525
2626
// Equivalent to `Stage::Beginner`.
2727
let stage = Beginner;

rust-by-example/src/custom_types/enum/testcase_linked_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl List {
3838
match *self {
3939
// Can't take ownership of the tail, because `self` is borrowed;
4040
// instead take a reference to the tail
41-
// And it'a a non-tail recursive call which may cause stack overflow for long lists.
41+
// And it's a non-tail recursive call which may cause stack overflow for long lists.
4242
Cons(_, ref tail) => 1 + tail.len(),
4343
// Base Case: An empty list has zero length
4444
Nil => 0

rust-by-example/src/flow_control/match/binding.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ fn main() {
2525
// Now the age can be reported.
2626
n @ 1 ..= 12 => println!("I'm a child of age {:?}", n),
2727
n @ 13 ..= 19 => println!("I'm a teen of age {:?}", n),
28+
// A similar binding can be done when matching several values.
29+
n @ (1 | 7 | 15 | 13) => println!("I'm a teen of age {:?}", n),
2830
// Nothing bound. Return the result.
2931
n => println!("I'm an old person of age {:?}", n),
3032
}

rust-by-example/src/flow_control/match/destructuring.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ A `match` block can destructure items in a variety of ways.
1313
[struct]: destructuring/destructure_structures.md
1414
[tuple]: destructuring/destructure_tuple.md
1515
[slice]: destructuring/destructure_slice.md
16+
17+
### See also:
18+
19+
[The Rust Reference for Destructuring](https://doc.rust-lang.org/reference/patterns.html#r-patterns.destructure)

rust-by-example/src/scope/lifetime/static_lifetime.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ does not:
100100
```rust,editable,compile_fail
101101
use std::fmt::Debug;
102102
103-
fn print_it( input: impl Debug + 'static ) {
104-
println!( "'static value passed in is: {:?}", input );
103+
fn print_it(input: impl Debug + 'static) {
104+
println!("'static value passed in is: {:?}", input);
105105
}
106106
107107
fn main() {

0 commit comments

Comments
 (0)