@@ -15,24 +15,33 @@ the "travis example" badge above.
15
15
16
16
You can run ` rustfmt ` with Rust 1.24 and above.
17
17
18
+ ### On the Stable toolchain
19
+
18
20
To install:
19
21
20
- ```
22
+ ``` sh
21
23
rustup component add rustfmt
22
24
```
23
25
24
- to run on a cargo project in the current working directory:
26
+ To run on a cargo project in the current working directory:
25
27
26
- ```
28
+ ``` sh
27
29
cargo fmt
28
30
```
29
31
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
32
39
rustup component add rustfmt --toolchain nightly
33
40
```
34
- To run:
35
- ```
41
+
42
+ To run on a cargo project in the current working directory:
43
+
44
+ ``` sh
36
45
cargo +nightly fmt
37
46
```
38
47
@@ -67,15 +76,15 @@ because in the future Rustfmt might work on code where it currently does not):
67
76
68
77
## Installation
69
78
70
- ```
79
+ ``` sh
71
80
rustup component add rustfmt
72
81
```
73
82
74
83
## Installing from source
75
84
76
85
To install from source (nightly required), first checkout to the tag or branch you want to install, then issue
77
86
78
- ```
87
+ ``` sh
79
88
cargo install --path .
80
89
```
81
90
@@ -161,6 +170,11 @@ Configuration options are either stable or unstable. Stable options can always
161
170
be used, while unstable ones are only available on a nightly toolchain, and opt-in.
162
171
See [Configurations.md](Configurations.md) for details.
163
172
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"`.
164
178
165
179
# # Tips
166
180
@@ -178,7 +192,7 @@ See [Configurations.md](Configurations.md) for details.
178
192
179
193
Example :
180
194
181
- ```
195
+ ` ` ` sh
182
196
cargo fmt -- --emit files
183
197
` ` `
184
198
0 commit comments