Skip to content

Commit 940beaa

Browse files
authored
Merge pull request #1711 from bmwant/bmwant/fix-let-else-example
Update let-else example with main function
2 parents a071456 + 452ba02 commit 940beaa

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ We use the following labels:
4444

4545
## Development workflow
4646

47-
To build RBE, [install Rust], and then:
47+
To build RBE, [install Rust](https://www.rust-lang.org/tools/install), and then:
4848

4949
```bash
5050
$ git clone https://github.com/rust-lang/rust-by-example
@@ -56,7 +56,7 @@ $ mdbook build
5656
[install Rust]: http://rust-lang.org/install.html
5757

5858
The files will be in the `book` directory at the top-level; `mdbook serve` will
59-
open the contents in your web browser.
59+
open the contents in your web browser ([localhost:3000](http://localhost:3000) by default).
6060

6161
To run the tests:
6262

src/flow_control/let_else.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33

44
> 🛈 stable since: rust 1.65
5+
>
6+
> 🛈 you can target specific edition by compiling like this
7+
> `rustc --edition=2021 main.rs`
58
69

710
With `let`-`else`, a refutable pattern can match and bind variables
@@ -22,7 +25,9 @@ fn get_count_item(s: &str) -> (u64, &str) {
2225
(count, item)
2326
}
2427

25-
assert_eq!(get_count_item("3 chairs"), (3, "chairs"));
28+
fn main() {
29+
assert_eq!(get_count_item("3 chairs"), (3, "chairs"));
30+
}
2631
```
2732

2833
The scope of name bindings is the main thing that makes this different from

0 commit comments

Comments
 (0)