Skip to content

Commit e3f7d46

Browse files
committed
Update to edition 2021 and fix tests.
1 parent eb85acd commit e3f7d46

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

book.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ enable = true
1212

1313
[output.html]
1414
git-repository-url = "https://github.com/rust-lang/rust-by-example"
15+
16+
[rust]
17+
edition = "2021"

src/error/result/enter_question_mark.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The `?` operator is now recommended, but you may still find `try!` when looking
4343
at older code. The same `multiply` function from the previous example
4444
would look like this using `try!`:
4545

46-
```rust,editable
46+
```rust,editable,edition2015
4747
// To compile and run this example without errors, while using Cargo, change the value
4848
// of the `edition` field, in the `[package]` section of the `Cargo.toml` file, to "2015".
4949

src/fn/closures/closure_examples/iter_any.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn main() {
3535
// `iter()` for arrays yields `&i32`.
3636
println!("2 in array1: {}", array1.iter() .any(|&x| x == 2));
3737
// `into_iter()` for arrays unusually yields `&i32`.
38-
println!("2 in array2: {}", array2.into_iter().any(|&x| x == 2));
38+
println!("2 in array2: {}", array2.iter().any(|&x| x == 2));
3939
}
4040
```
4141

src/generics/assoc_items/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait Contains {
1313
type B;
1414

1515
// Updated syntax to refer to these new types generically.
16-
fn contains(&self, &Self::A, &Self::B) -> bool;
16+
fn contains(&self, _: &Self::A, _: &Self::B) -> bool;
1717
}
1818
```
1919

0 commit comments

Comments
 (0)