Skip to content

Commit 12cbbd3

Browse files
cuvipertmandry
andcommitted
Apply Tyler's suggestions from code review
Co-authored-by: Tyler Mandry <[email protected]>
1 parent 04c735b commit 12cbbd3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

posts/2021-10-21-Rust-1.56.0.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ avoid breaking some corner cases in existing code. See the new chapters of the
3232
edition guide below for more details on each new feature and guidance for
3333
migration.
3434

35-
* [Disjoint capture in closures](https://doc.rust-lang.org/edition-guide/rust-2021/disjoint-capture-in-closures.html) rather than always capturing whole identifiers.
36-
* [`IntoIterator` for arrays](https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html) now includes `array.into_iter()` calls.
35+
* [Disjoint capture](https://doc.rust-lang.org/edition-guide/rust-2021/disjoint-capture-in-closures.html): closures now capture individual named fields rather than always capturing whole identifiers.
36+
* [`IntoIterator` for arrays](https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html): `array.into_iter()` now iterates over items by value instead of by reference.
3737
* [Or patterns in macro-rules](https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html) now match top-level `A|B` in `:pat`.
3838
* [Default Cargo feature resolver](https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html) is now version 2.
39-
* [Additions to the prelude](https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html): `TryInto`, `TryFrom`, and `FromIterator`.
40-
* [Panic macro consistency](https://doc.rust-lang.org/edition-guide/rust-2021/panic-macro-consistency.html) now always uses `format_args!(..)`, just like `println!()`.
39+
* [Additions to the prelude](https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html): `TryInto`, `TryFrom`, and `FromIterator` are now in scope by default.
40+
* [Panic macros](https://doc.rust-lang.org/edition-guide/rust-2021/panic-macro-consistency.html) now always expect format strings, just like `println!()`.
4141
* [Reserving syntax](https://doc.rust-lang.org/edition-guide/rust-2021/reserving-syntax.html) for `ident#`, `ident"..."`, and `ident'...'`.
4242
* [Warnings promoted to errors](https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html): `bare_trait_objects` and `ellipsis_inclusive_range_patterns`.
4343

@@ -52,11 +52,14 @@ let's look at a quick example:
5252
// 2015 or 2018 edition code
5353
let a = SomeStruct::new();
5454

55-
drop(a.x); // Move out of one field of the struct
55+
// Move out of one field of the struct
56+
drop(a.x);
5657

57-
println!("{}", a.y); // Ok: Still use another field of the struct
58+
// Ok: Still use another field of the struct
59+
println!("{}", a.y);
5860

59-
let c = || println!("{}", a.y); // Error: Tries to capture all of `a`
61+
// Error: Before 2021 edition, tries to capture all of `a`
62+
let c = || println!("{}", a.y);
6063
c();
6164
```
6265

@@ -174,6 +177,6 @@ and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#r
174177

175178
### Contributors to 1.56.0
176179

177-
Many people came together to create Rust 1.56.0.
180+
Many people came together to create Rust 1.56.0 and the 2021 edition.
178181
We couldn't have done it without all of you.
179182
[Thanks!](https://thanks.rust-lang.org/rust/1.56.0/)

0 commit comments

Comments
 (0)