Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 78d4fca

Browse files
committed
indicate in the readme that edition may need to be written in rustfmt.toml
1 parent d2e91b5 commit 78d4fca

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,33 @@ the "travis example" badge above.
1515

1616
You can run `rustfmt` with Rust 1.24 and above.
1717

18+
### On the Stable toolchain
19+
1820
To install:
1921

20-
```
22+
```sh
2123
rustup component add rustfmt
2224
```
2325

24-
to run on a cargo project in the current working directory:
26+
To run on a cargo project in the current working directory:
2527

26-
```
28+
```sh
2729
cargo fmt
2830
```
2931

30-
For the latest and greatest `rustfmt` (nightly required):
31-
```
32+
### On the Nightly toolchain
33+
34+
For the latest and greatest `rustfmt`, nightly is required.
35+
36+
To install:
37+
38+
```sh
3239
rustup component add rustfmt --toolchain nightly
3340
```
34-
To run:
35-
```
41+
42+
To run on a cargo project in the current working directory:
43+
44+
```sh
3645
cargo +nightly fmt
3746
```
3847

@@ -67,15 +76,15 @@ because in the future Rustfmt might work on code where it currently does not):
6776

6877
## Installation
6978

70-
```
79+
```sh
7180
rustup component add rustfmt
7281
```
7382

7483
## Installing from source
7584

7685
To install from source (nightly required), first checkout to the tag or branch you want to install, then issue
7786

78-
```
87+
```sh
7988
cargo install --path .
8089
```
8190

@@ -161,6 +170,11 @@ Configuration options are either stable or unstable. Stable options can always
161170
be used, while unstable ones are only available on a nightly toolchain, and opt-in.
162171
See [Configurations.md](Configurations.md) for details.
163172

173+
### Rust's Editions
174+
175+
Rustfmt is able to pick up the edition used by reading the `Cargo.toml` file if
176+
executed through the Cargo's formatting tool `cargo fmt`. Otherwise, the edition
177+
needs to be specified in `rustfmt.toml`, e.g., with `edition = "2018"`.
164178

165179
## Tips
166180

@@ -178,7 +192,7 @@ See [Configurations.md](Configurations.md) for details.
178192

179193
Example:
180194

181-
```
195+
```sh
182196
cargo fmt -- --emit files
183197
```
184198

0 commit comments

Comments
 (0)