Skip to content

Commit 01e2f7b

Browse files
authored
Merge pull request #70 from alexcrichton/idioms
Migrate to using `cargo fix --edition-idioms`
2 parents 47b1501 + 86542ae commit 01e2f7b

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

src/editions/transitioning.md

+13-18
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ new 2018 edition. This is where the handy `cargo fix` tool comes into the
5252
picture. To enable the compatibility lints for your project you run:
5353

5454
```shell
55-
$ cargo +nightly fix --prepare-for 2018 --all-targets --all-features
55+
$ cargo fix --edition
5656
```
5757

5858
This will instruct Cargo to compile all targets in your project (libraries,
@@ -67,7 +67,7 @@ warnings. Continue to run the above command until all warnings have been solved.
6767
You can explore more about the `cargo fix` command with:
6868

6969
```shell
70-
$ cargo +nightly fix --help
70+
$ cargo fix --help
7171
```
7272

7373
## Switch to the next edition
@@ -86,7 +86,7 @@ That `cargo-features` line should go at the very top; and `edition` goes into
8686
the `[package]` section. As mentioned above, right now this is a nightly-only
8787
feature of Cargo, so you need to enable it for things to work.
8888

89-
At this point, your project should compile with a regular old `cargo +nightly
89+
At this point, your project should compile with a regular old `cargo
9090
build`. If it does not, this is a bug! Please [file an issue][issue].
9191

9292
[issue]: https://github.com/rust-lang/rust/issues/new
@@ -98,22 +98,17 @@ that Editions in Rust signify a shift in idioms over time. While much old
9898
code will continue to compile it might be written with different idioms today.
9999

100100
An optional next step you can take is to update your code to be idiomatic within
101-
the new edition. This is done with a different set of "idiom lints". To enable
102-
these lints add this to your `lib.rs` or `main.rs`:
103-
104-
```rust
105-
#![warn(rust_2018_idioms)]
106-
```
107-
108-
Note that since you already switched to the new edition in the previous section,
109-
you should no longer pass the `--prepare-for 2018` flag to `cargo fix` because
110-
you are now already on the next edition! Execute:
101+
the new edition. This is done with a different set of "idiom lints". Like before
102+
we'll be using `cargo fix` to drive this process:
111103

112104
```shell
113-
$ cargo +nightly fix
105+
$ cargo fix --edition-idioms
114106
```
115107

116-
As before Cargo will automatically fix as much as it can, but you may also need
117-
to fix some warnings manually. Once all warnings have been solved you're not
118-
only compiling with the 2018 edition but you're also already writing idiomatic
119-
2018 code!
108+
Additionally like before, this is intended to be an *easy* step. Here `cargo
109+
fix` will automatically fix any lints it can, so you'll only get warnings for
110+
things that `cargo fix` couldn't fix. If you find it difficult to work through
111+
the warnings, that's a bug!
112+
113+
Once you're warning-free with this command you're good to go. Enjoy the new
114+
edition!

0 commit comments

Comments
 (0)