]> git.lizzy.rs Git - rust.git/blob - CHANGELOG.md
Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum
[rust.git] / CHANGELOG.md
1 # Changelog
2
3 ## [Unreleased]
4
5 ## [1.4.37] 2021-04-03
6
7 ### Changed
8
9 - `rustc-ap-*` crates updated to v712.0.0
10
11 ### Fixed
12 - Resolve idempotence issue related to indentation of macro defs that contain or-patterns with inner comments ([#4603](https://github.com/rust-lang/rustfmt/issues/4603))
13 - Addressed various clippy and rustc warnings
14
15 ### Install/Download Options
16 - **crates.io package** - *pending*
17 - **rustup (nightly)** - *pending*
18 - **GitHub Release Binaries** - [Release v1.4.37](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.37)
19 - **Build from source** - [Tag v1.4.37](https://github.com/rust-lang/rustfmt/tree/v1.4.37), see instructions for how to [install rustfmt from source][install-from-source]
20
21 ## [1.4.36] 2021-02-07
22
23 ### Changed
24
25 - `rustc-ap-*` crates updated to v705.0.0
26
27 ### Install/Download Options
28 - **crates.io package** - *pending*
29 - **rustup (nightly)** - *pending*
30 - **GitHub Release Binaries** - [Release v1.4.36](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.36)
31 - **Build from source** - [Tag v1.4.36](https://github.com/rust-lang/rustfmt/tree/v1.4.36), see instructions for how to [install rustfmt from source][install-from-source]
32
33 ## [1.4.35] 2021-02-03
34
35 ### Changed
36
37 - `rustc-ap-*` crates updated to v702.0.0
38
39 ### Install/Download Options
40 - **crates.io package** - *pending*
41 - **rustup (nightly)** - *n/a (superseded by [v1.4.36](#1436-2021-02-07))
42 - **GitHub Release Binaries** - [Release v1.4.35](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.35)
43 - **Build from source** - [Tag v1.4.35](https://github.com/rust-lang/rustfmt/tree/v1.4.35), see instructions for how to [install rustfmt from source][install-from-source]
44
45 ## [1.4.34] 2021-01-28
46
47 ### Fixed
48 - Don't insert trailing comma on (base-less) rest in struct literals within macros ([#4675](https://github.com/rust-lang/rustfmt/issues/4675))
49
50 ### Install/Download Options
51 - **crates.io package** - *pending*
52 - **rustup (nightly)** - Starting in `2021-01-31`
53 - **GitHub Release Binaries** - [Release v1.4.34](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.34)
54 - **Build from source** - [Tag v1.4.34](https://github.com/rust-lang/rustfmt/tree/v1.4.34), see instructions for how to [install rustfmt from source][install-from-source]
55
56 ## [1.4.33] 2021-01-27
57
58 ### Changed
59 - `merge_imports` configuration has been deprecated in favor of the new `imports_granularity` option. Any existing usage of `merge_imports` will be automatically mapped to the corresponding value on `imports_granularity` with a warning message printed to encourage users to update their config files.
60
61 ### Added
62 - New `imports_granularity` option has been added which succeeds `merge_imports`. This new option supports several additional variants which allow users to merge imports at different levels (crate or module), and even flatten imports to have a single use statement per item. ([PR #4634](https://github.com/rust-lang/rustfmt/pull/4634), [PR #4639](https://github.com/rust-lang/rustfmt/pull/4639))
63
64 See the section on the configuration site for more information
65 https://rust-lang.github.io/rustfmt/?version=v1.4.33&search=#imports_granularity
66
67 ### Fixed
68 - Fix erroneous removal of `const` keyword on const trait impl ([#4084](https://github.com/rust-lang/rustfmt/issues/4084))
69 - Fix incorrect span usage wit const generics in supertraits ([#4204](https://github.com/rust-lang/rustfmt/issues/4204))
70 - Use correct span for const generic params ([#4263](https://github.com/rust-lang/rustfmt/issues/4263))
71 - Correct span on const generics to include type bounds ([#4310](https://github.com/rust-lang/rustfmt/issues/4310))
72 - Idempotence issue on blocks containing only empty statements ([#4627](https://github.com/rust-lang/rustfmt/issues/4627) and [#3868](https://github.com/rust-lang/rustfmt/issues/3868))
73 - Fix issue with semicolon placement on required functions that have a trailing comment that ends in a line-style comment before the semicolon ([#4646](https://github.com/rust-lang/rustfmt/issues/4646))
74 - Avoid shared interned cfg_if symbol since rustfmt can re-initialize the rustc_ast globals on multiple inputs ([#4656](https://github.com/rust-lang/rustfmt/issues/4656))
75
76 ### Install/Download Options
77 - **crates.io package** - *pending*
78 - **rustup (nightly)** - n/a (superseded by [v1.4.34](#1434-2021-01-28))
79 - **GitHub Release Binaries** - [Release v1.4.33](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.33)
80 - **Build from source** - [Tag v1.4.33](https://github.com/rust-lang/rustfmt/tree/v1.4.33), see instructions for how to [install rustfmt from source][install-from-source]
81
82 ## [1.4.32] 2021-01-16
83
84 ### Fixed
85 - Indentation now correct on first bound in cases where the generic bounds are multiline formatted and the first bound itself is multiline formatted ([#4636](https://github.com/rust-lang/rustfmt/issues/4636))
86
87 ### Install/Download Options
88 - **crates.io package** - *pending*
89 - **rustup (nightly)** - Starting in `2021-01-18`
90 - **GitHub Release Binaries** - [Release v1.4.32](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.32)
91 - **Build from source** - [Tag v1.4.32](https://github.com/rust-lang/rustfmt/tree/v1.4.32), see instructions for how to [install rustfmt from source][install-from-source]
92
93 ## [1.4.31] 2021-01-09
94
95 ### Changed
96
97 - `rustc-ap-*` crates updated to v697.0.0
98
99 ### Added
100 - Support for 2021 Edition [#4618](https://github.com/rust-lang/rustfmt/pull/4618))
101
102 ### Install/Download Options
103 - **crates.io package** - *pending*
104 - **rustup (nightly)** - Starting in `2021-01-16`
105 - **GitHub Release Binaries** - [Release v1.4.31](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.31)
106 - **Build from source** - [Tag v1.4.31](https://github.com/rust-lang/rustfmt/tree/v1.4.31), see instructions for how to [install rustfmt from source][install-from-source]
107
108 ## [1.4.30] 2020-12-20
109
110 ### Fixed
111 - Last character in derive no longer erroneously stripped when `indent_style` is overridden to `Visual`. ([#4584](https://github.com/rust-lang/rustfmt/issues/4584))
112 - Brace wrapping of closure bodies maintained in cases where the closure has an explicit return type and the body consists of a single expression statement. ([#4577](https://github.com/rust-lang/rustfmt/issues/4577))
113 - No more panics on invalid code with `err` and `typeof` types ([#4357](https://github.com/rust-lang/rustfmt/issues/4357), [#4586](https://github.com/rust-lang/rustfmt/issues/4586))
114
115 ### Install/Download Options
116 - **crates.io package** - *pending*
117 - **rustup (nightly)** - Starting in `2020-12-25`
118 - **GitHub Release Binaries** - [Release v1.4.30](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.30)
119 - **Build from source** - [Tag v1.4.30](https://github.com/rust-lang/rustfmt/tree/v1.4.30), see instructions for how to [install rustfmt from source][install-from-source]
120
121 ## [1.4.29] 2020-12-04
122
123 ### Fixed
124 - Negative polarity on non-trait impl now preserved. ([#4566](https://github.com/rust-lang/rustfmt/issues/4566))
125
126 ### Install/Download Options
127 - **crates.io package** - *pending*
128 - **rustup (nightly)** - Starting in `2020-12-07`
129 - **GitHub Release Binaries** - [Release v1.4.29](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.29)
130 - **Build from source** - [Tag v1.4.29](https://github.com/rust-lang/rustfmt/tree/v1.4.29), see instructions for how to [install rustfmt from source][install-from-source]
131
132 ## [1.4.28] 2020-11-29
133
134 ### Changed
135
136 - `rustc-ap-*` crates updated to v691.0.0
137 - In the event of an invalid inner attribute on a `cfg_if` condition, rustfmt will now attempt to continue and format the imported modules. Previously rustfmt would emit the parser error about an inner attribute being invalid in this position, but for rustfmt's purposes the invalid attribute doesn't prevent nor impact module formatting.
138
139 ### Added
140
141 - [`group_imports`][group-imports-config-docs] - a new configuration option that allows users to control the strategy used for grouping imports ([#4107](https://github.com/rust-lang/rustfmt/issues/4107))
142
143 [group-imports-config-docs]: https://github.com/rust-lang/rustfmt/blob/v1.4.28/Configurations.md#group_imports
144
145 ### Fixed
146 - Formatting of malformed derived attributes is no longer butchered. ([#3898](https://github.com/rust-lang/rustfmt/issues/3898), [#4029](https://github.com/rust-lang/rustfmt/issues/4029), [#4115](https://github.com/rust-lang/rustfmt/issues/4115), [#4545](https://github.com/rust-lang/rustfmt/issues/4545))
147 - Correct indentation used in macro branches when `hard_tabs` is enabled. ([#4152](https://github.com/rust-lang/rustfmt/issues/4152))
148 - Comments between the visibility modifier and item name are no longer dropped. ([#2781](https://github.com/rust-lang/rustfmt/issues/2781))
149 - Comments preceding the assignment operator in type aliases are no longer dropped. ([#4244](https://github.com/rust-lang/rustfmt/issues/4244))
150 - Comments between {`&` operator, lifetime, `mut` kw, type} are no longer dropped. ([#4245](https://github.com/rust-lang/rustfmt/issues/4245))
151 - Comments between type bounds are no longer dropped. ([#4243](https://github.com/rust-lang/rustfmt/issues/4243))
152 - Function headers are no longer dropped on foreign function items. ([#4288](https://github.com/rust-lang/rustfmt/issues/4288))
153 - Foreign function blocks are no longer dropped. ([#4313](https://github.com/rust-lang/rustfmt/issues/4313))
154 - `where_single_line` is no longer incorrectly applied to multiline function signatures that have no `where` clause. ([#4547](https://github.com/rust-lang/rustfmt/issues/4547))
155 - `matches!` expressions with multiple patterns and a destructure pattern are now able to be formatted. ([#4512](https://github.com/rust-lang/rustfmt/issues/4512))
156
157 ### Install/Download Options
158 - **crates.io package** - *pending*
159 - **rustup (nightly)** - n/a (superseded by [v1.4.29](#1429-2020-12-04))
160 - **GitHub Release Binaries** - [Release v1.4.28](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.28)
161 - **Build from source** - [Tag v1.4.28](https://github.com/rust-lang/rustfmt/tree/v1.4.28), see instructions for how to [install rustfmt from source][install-from-source]
162
163 ## [1.4.27] 2020-11-16
164
165 ### Fixed
166
167 - Leading comments in an extern block are no longer dropped (a bug that exists in v1.4.26). ([#4528](https://github.com/rust-lang/rustfmt/issues/4528))
168
169 ### Install/Download Options
170 - **crates.io package** - *pending*
171 - **rustup (nightly)** - Starting in `2020-11-18`
172 - **GitHub Release Binaries** - [Release v1.4.27](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.27)
173 - **Build from source** - [Tag v1.4.27](https://github.com/rust-lang/rustfmt/tree/v1.4.27), see instructions for how to [install rustfmt from source][install-from-source]
174
175 ## [1.4.26] 2020-11-14
176
177 ### Changed
178
179 - Original comment indentation for trailing comments within an `if` is now taken into account when determining the indentation level to use for the trailing comment in formatted code. This does not modify any existing code formatted with rustfmt; it simply gives the programmer discretion to specify whether the comment is associated to the `else` block, or if the trailing comment is just a member of the `if` block. ([#1575](https://github.com/rust-lang/rustfmt/issues/1575), [#4120](https://github.com/rust-lang/rustfmt/issues/4120), [#4506](https://github.com/rust-lang/rustfmt/issues/4506))
180
181 In this example the `// else comment` refers to the `else`:
182 ```rust
183 // if comment
184 if cond {
185     "if"
186 // else comment
187 } else {
188     "else"
189 }
190 ```
191
192 Whereas in this case the `// continue` comments are members of their respective blocks and do not refer to the `else` below.
193 ```rust
194 if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"))? {
195     if toks.eat_token(Token::Colon)? {
196         // ate the token
197     } else if toks.eat_token(Token::Word("to"))? {
198         // optionally eat the colon after to, e.g.:
199         // @rustbot modify labels to: -S-waiting-on-author, +S-waiting-on-review
200         toks.eat_token(Token::Colon)?;
201     } else {
202         // It's okay if there's no to or colon, we can just eat labels
203         // afterwards.
204     }
205     1 + 2;
206     // continue
207 } else if toks.eat_token(Token::Word("label"))? {
208     // continue
209 } else {
210     return Ok(None);
211 }
212 ```
213
214 ### Fixed
215 - Formatting of empty blocks with attributes which only contained comments is no longer butchered.([#4475](https://github.com/rust-lang/rustfmt/issues/4475), [#4467](https://github.com/rust-lang/rustfmt/issues/4467), [#4452](https://github.com/rust-lang/rustfmt/issues/4452#issuecomment-705886282), [#4522](https://github.com/rust-lang/rustfmt/issues/4522))
216 - Indentation of trailing comments in non-empty extern blocks is now correct. ([#4120](https://github.com/rust-lang/rustfmt/issues/4120#issuecomment-696491872))
217
218 ### Install/Download Options
219 - **crates.io package** - *pending*
220 - **rustup (nightly)** - Starting in `2020-11-16`
221 - **GitHub Release Binaries** - [Release v1.4.26](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.26)
222 - **Build from source** - [Tag v1.4.26](https://github.com/rust-lang/rustfmt/tree/v1.4.26), see instructions for how to [install rustfmt from source][install-from-source]
223
224 ## [1.4.25] 2020-11-10
225
226 ### Changed
227
228 - Semicolons are no longer automatically inserted on trailing expressions in macro definition arms ([#4507](https://github.com/rust-lang/rustfmt/pull/4507)). This gives the programmer control and discretion over whether there should be semicolons in these scenarios so that potential expansion issues can be avoided.
229
230 ### Install/Download Options
231 - **crates.io package** - *pending*
232 - **rustup (nightly)** - Starting in `2020-11-14`
233 - **GitHub Release Binaries** - [Release v1.4.25](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.25)
234 - **Build from source** - [Tag v1.4.25](https://github.com/rust-lang/rustfmt/tree/v1.4.25), see instructions for how to [install rustfmt from source][install-from-source]
235
236 ## [1.4.24] 2020-11-05
237
238 ### Changed
239
240 - Block wrapped match arm bodies containing a single macro call expression are no longer flattened ([#4496](https://github.com/rust-lang/rustfmt/pull/4496)). This allows programmer discretion so that the block wrapping can be preserved in cases where needed to prevent issues in expansion, such as with trailing semicolons, and aligns with updated [Style Guide guidance](https://github.com/rust-dev-tools/fmt-rfcs/blob/master/guide/expressions.md#macro-call-expressions) for such scenarios.
241
242 ### Fixed
243 - Remove useless `deprecated` attribute on a trait impl block in the rustfmt lib, as these now trigger errors ([rust-lang/rust/#78626](https://github.com/rust-lang/rust/pull/78626))
244
245 ### Install/Download Options
246 - **crates.io package** - *pending*
247 - **rustup (nightly)** - Starting in `2020-11-09`
248 - **GitHub Release Binaries** - [Release v1.4.24](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.24)
249 - **Build from source** - [Tag v1.4.24](https://github.com/rust-lang/rustfmt/tree/v1.4.24), see instructions for how to [install rustfmt from source][install-from-source]
250
251 ## [1.4.23] 2020-10-30
252
253 ### Changed
254
255 - Update `rustc-ap-*` crates to v686.0.0
256
257 ### Added
258 - Initial support for formatting new ConstBlock syntax ([#4478](https://github.com/rust-lang/rustfmt/pull/4478))
259
260 ### Fixed
261 - Handling of unclosed delimiter-only parsing errors in input files ([#4466](https://github.com/rust-lang/rustfmt/issues/4466))
262 - Misc. minor parser bugs ([#4418](https://github.com/rust-lang/rustfmt/issues/4418) and [#4431](https://github.com/rust-lang/rustfmt/issues/4431))
263 - Panic on nested tuple access ([#4355](https://github.com/rust-lang/rustfmt/issues/4355))
264 - Unable to disable license template path via cli override ([#4487](https://github.com/rust-lang/rustfmt/issues/4487))
265 - Preserve comments in empty statements [#4018](https://github.com/rust-lang/rustfmt/issues/4018))
266 - Indentation on skipped code [#4398](https://github.com/rust-lang/rustfmt/issues/4398))
267
268 ### Install/Download Options
269 - **crates.io package** - *pending*
270 - **rustup (nightly)** - n/a (superseded by [v1.4.24](#1424-2020-11-05))
271 - **GitHub Release Binaries** - [Release v1.4.23](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.23)
272 - **Build from source** - [Tag v1.4.23](https://github.com/rust-lang/rustfmt/tree/v1.4.23), see instructions for how to [install rustfmt from source][install-from-source]
273
274
275
276 ## [1.4.22] 2020-10-04
277
278 ### Changed
279
280 - Update `rustc-ap-*` crates to v679.0.0
281 - Add config option to allow control of leading match arm pipes
282 - Support `RUSTFMT` environment variable in `cargo fmt` to run specified `rustfmt` instance
283
284 ### Fixed
285
286 - Fix preservation of type aliases within extern blocks
287
288
289 ## [1.4.9] 2019-10-07
290
291 ### Changed
292
293 - Update `rustc-ap-*` crates to 606.0.0.
294
295 ### Fixed
296
297 - Fix aligning comments of different group
298 - Fix flattening imports with a single `self`.
299 - Fix removing attributes on function parameters.
300 - Fix removing `impl` keyword from opaque type.
301
302 ## [1.4.8] 2019-09-08
303
304 ### Changed
305
306 - Update `rustc-ap-*` crates to 583.0.0.
307
308 ## [1.4.7] 2019-09-06
309
310 ### Added
311
312 - Add `--config` command line option.
313
314 ### Changed
315
316 - Update `rustc-ap-*` crates to 581.0.0.
317 - rustfmt now do not warn against trailing whitespaces inside macro calls.
318
319 ### Fixed
320
321 - Fix `merge_imports` generating invalid code.
322 - Fix removing discriminant values on enum variants.
323 - Fix modules defined inside `cfg_if!` not being formatted.
324 - Fix minor formatting issues.
325
326 ## [1.4.6] 2019-08-28
327
328 ### Added
329
330 - Add `--message-format` command line option to `cargo-fmt`.
331 - Add `-l,--files-with-diff` command line option to `rustfmt`.
332 - Add `json` emit mode.
333
334 ### Fixed
335
336 - Fix removing attributes on struct pattern's fields.
337 - Fix non-idempotent formatting of match arm.
338 - Fix `merge_imports` generating invalid code.
339 - Fix imports with `#![macro_use]` getting reordered with `reorder_imports`.
340 - Fix calculation of line numbers in checkstyle output.
341 - Fix poor formatting of complex fn type.
342
343 ## [1.4.5] 2019-08-13
344
345 ### Fixed
346
347 - Fix generating invalid code when formatting an impl block with const generics inside a where clause.
348 - Fix adding a trailing space after a `dyn` keyword which is used as a macro argument by itself.
349
350 ## [1.4.4] 2019-08-06
351
352 ### Fixed
353
354 - Fix `cargo fmt` incorrectly formatting crates that is not part of the workspace or the path dependencies.
355 - Fix removing a trailing comma from a tuple pattern.
356
357 ## [1.4.3] 2019-08-02
358
359 ### Changed
360
361 - Update `rustc-ap-*` crates to 546.0.0.
362
363 ### Fixed
364
365 - Fix an underscore pattern getting removed.
366
367 ## [1.4.2] 2019-07-31
368
369 ### Changed
370
371 - Explicitly require the version of `rustfmt-config_proc_macro` to be 0.1.2 or later.
372
373 ## [1.4.1] 2019-07-30
374
375 ### Changed
376
377 - Update `rustc-ap-*` crates to 542.0.0.
378
379 ## [1.4.0] 2019-07-29
380
381 ### Added
382
383 - Add new attribute `rustfmt::skip::attributes` to prevent rustfmt
384 from formatting an attribute #3665
385
386 ### Changed
387
388 - Update `rustc-ap-*` crates to 541.0.0.
389 - Remove multiple semicolons.
390
391 ## [1.3.3] 2019-07-15
392
393 ### Added
394
395 - Add `--manifest-path` support to `cargo fmt` (#3683).
396
397 ### Fixed
398
399 - Fix `cargo fmt -- --help` printing nothing (#3620).
400 - Fix inserting an extra comma (#3677).
401 - Fix incorrect handling of CRLF with `file-lines` (#3684).
402 - Fix `print-config=minimal` option (#3687).
403
404 ## [1.3.2] 2019-07-06
405
406 ### Fixed
407
408 - Fix rustfmt crashing when `await!` macro call is used in a method chain.
409 - Fix rustfmt not recognizing a package whose name differs from its directory's name.
410
411 ## [1.3.1] 2019-06-30
412
413 ### Added
414
415 - Implement the `Display` trait on the types of `Config`.
416
417 ### Changed
418
419 - `ignore` configuration option now only supports paths separated by `/`. Windows-style paths are not supported.
420 - Running `cargo fmt` in a sub-directory of a project is now supported.
421
422 ### Fixed
423
424 - Fix bugs that may cause rustfmt to crash.
425
426 ## [1.3.0] 2019-06-09
427
428 ### Added
429
430 - Format modules defined inside `cfg_if` macro calls #3600
431
432 ### Changed
433
434 - Change option `format_doc_comment` to `format_code_in_doc_comment`.
435 - `use_small_heuristics` changed to be an enum and stabilised. Configuration
436   options are now ready for 1.0.
437 - Stabilise `fn_args_density` configuration option and rename it to `fn_args_layout` #3581
438 - Update `rustc-ap-*` crates to 486.0.0
439 - Ignore sub-modules when skip-children is used #3607
440 - Removed bitrig support #3608
441
442 ### Fixed
443
444 - `wrap_comments` should not imply `format_doc_comments` #3535
445 - Incorrect handling of const generics #3555
446 - Add the handling for `vec!` with paren inside macro #3576
447 - Format trait aliases with where clauses #3586
448 - Catch panics from the parser while rewriting macro calls #3589
449 - Fix erasing inner attributes in struct #3593
450 - Inline the attribute with its item even with the `macro_use` attribute or when `reorder_imports` is disabled #3598
451 - Fix the bug add unwanted code to impl #3602
452
453 ## [1.2.2] 2019-04-24
454
455 ### Fixed
456
457 - Fix processing of `ignore` paths #3522
458 - Attempt to format attributes if only they exist #3523
459
460 ## [1.2.1] 2019-04-18
461
462 ### Added
463
464 - Add `--print-config current` CLI option b473e65
465 - Create GitHub [page](https://rust-lang.github.io/rustfmt/) for Configuration.md #3485
466
467 ### Fixed
468
469 - Keep comment appearing between parameter's name and its type #3491
470 - Do not delete semicolon after macro call with square brackets #3500
471 - Fix `--version` CLI option #3506
472 - Fix duplication of attributes on a match arm's body #3510
473 - Avoid overflowing item with attributes #3511
474
475 ## [1.2.0] 2019-03-27
476
477 ### Added
478
479 - Add new attribute `rustfmt::skip::macros` to prevent rustfmt from formatting a macro #3454
480
481 ### Changed
482
483 - Discard error report in silent_emitter #3466
484
485 ### Fixed
486
487 - Fix bad performance on deeply nested binary expressions #3467
488 - Use BTreeMap to guarantee consistent ordering b4d4b57
489
490 ## [1.1.1] 2019-03-21
491
492 ### Fixed
493
494 - Avoid panic on macro inside deeply nested block c9479de
495 - Fix line numbering in missed spans and handle file_lines in edge cases cdd08da
496 - Fix formatting of async blocks 1fa06ec
497 - Avoid duplication on the presence of spaces between macro name and `!` #3464
498
499 ## [1.1.0] 2019-03-17
500
501 ### Added
502
503 - Add `inline_attribute_width` configuration option to write an item and its attribute on the same line if their combined width is below a threshold #3409
504 - Support `const` generics f0c861b
505 - Support path clarity module #3448
506
507 ### Changed
508
509 - Align loop and while formatting 7d9a2ef
510 - Support `EmitMode::ModifiedLines` with stdin input #3424
511 - Update `rustc-ap-*` crates to 407.0.0
512 - Remove trailing whitespaces in missing spans 2d5bc69
513
514 ### Fixed
515
516 - Do not remove comment in the case of no arg 8e3ef3e
517 - Fix `Ident of macro+ident gets duplicated` error 40ff078
518 - Format the if expression at the end of the block in a single line 5f3dfe6
519
520 ## [1.0.3] 2019-02-14
521
522 ### Added
523
524 - Point unstable options to tracking issues 412dcc7
525
526 ### Changed
527
528 - Update `rustc-ap-*` crates to 373.0.0
529
530 ## [1.0.2] 2019-02-12
531
532 ### Added
533
534 - Add a [section](https://github.com/rust-lang/rustfmt/blob/ae331be/Contributing.md#version-gate-formatting-changes) to the Contributing.md file about version-gating formatting changes 36e2cb0
535 - Allow specifying package with `-p` CLI option a8d2591
536 - Support `rustfmt::skip` on imports #3289
537 - Support global `rustfmt.toml` to be written in user config directory #3280
538 - Format visibility on trait alias 96a3df3
539
540 ### Changed
541
542 - Do not modify original source code inside macro call #3260
543 - Recognize strings inside comments in order to avoid indenting them baa62c6
544 - Use Unicode-standard char width to wrap comments or strings a01990c
545 - Change new line point in the case of no args #3294
546 - Use the same formatting rule between functions and macros #3298
547 - Update rustc-ap-rustc_target to 366.0.0, rustc-ap-syntax to 366.0.0, and rustc-ap-syntax_pos to 366.0.0
548
549 ### Fixed
550
551 - rewrite_comment: fix block fallback when failing to rewrite an itemized block ab7f4e1
552 - Catch possible tokenizer panics #3240
553 - Fix macro indentation on Windows #3266
554 - Fix shape when formatting return or break expr on statement position #3259
555 - rewrite_comment: fix block fallback when failing to rewrite an itemized block
556 - Keep leading double-colon to respect the 2018 edition of rust's paths a2bfc02
557 - Fix glob and nested global imports 2125ad2
558 - Do not force trailing comma when using mixed layout #3306
559 - Prioritize `single_line_fn` and `empty_item_single_line` over `brace_style` #3308
560 - Fix `internal error: left behind trailing whitespace` with long lines c2534f5
561 - Fix attribute duplication #3325
562 - Fix formatting of strings within a macro 813aa79
563 - Handle a macro argument with a single keyword 9a7ea6a
564
565 ## [1.0.1] 2018-12-09
566
567 ### Added
568
569 - Add a `version` option 378994b
570
571 ### Changed
572
573 - End expressions like return/continue/break with a semicolon #3223
574 - Update rustc-ap-rustc_target to 306.0.0, rustc-ap-syntax to 306.0.0, and rustc-ap-syntax_pos to 306.0.0
575
576 ### Fixed
577
578 - Allow to run a rustfmt command from cargo-fmt even when there is no target a2da636
579 - Fix `un-closed delimiter` errors when formatting break labels 40174e9
580
581 ## [1.0.0] 2018-11-19
582
583 ### Changed
584
585 - Preserve possibly one whitespace for brace macros 1a3bc79
586 - Prefer to break arguments over putting output type on the next line 1dd54e6
587
588 ## [0.99.9] 2018-11-15
589
590 ### Changed
591
592 - Update rustc-ap-rustc_target to 297.0.0, rustc-ap-syntax to 297.0.0, to rustc-ap-syntax_pos to 297.0.0
593 - Don't align comments on `extern crate`s dd7add7
594
595 ## [0.99.8] 2018-11-14
596
597 ### Added
598
599 - Add `overflow_delimited_expr` config option to more aggressively allow overflow #3175
600
601 ### Fixed
602
603 - Fix the logic for retaining a comment before the arrow in a match #3181
604 - Do not wrap comments in doctest to avoid failing doctest runs #3183
605 - Fix comment rewriting that was wrapping code into a line comment #3188
606 - Fix formatting of unit-struct with `where`-clause #3200
607
608 ## [0.99.7] 2018-11-07
609
610 ### Changed
611
612 - Force a newline after the `if` condition if there is a different indentation level #3109
613 - Use correct width when formatting type on local statement #3126
614 - Treat crates non-alphabetically when ordering 799005f
615 - Fix formatting of code that is annotated with rustfmt::skip #3113
616 - Stabilize `edition` configuration option 9c3ae2d
617 - cargo-fmt: detect Rust edition in use #3129
618 - Trim the indentation on macros which heuristically appear to use block-style indentation #3178
619
620 ### Fixed
621
622 - Do not remove path disambiugator inside macro #3142
623 - Improve handling of Windows newlines #3141
624 - Fix alignment of a struct's fields (`struct_field_align_threshold` option) with the Visual `indent_style` #3165
625 - Fix a bug in formatting markdown lists within comments #3172
626
627 ## [0.99.6] 2018-10-18
628
629 ### Added
630
631 - Add `enum_discrim_align_threshold` option to vertically align enum discriminants cc22869
632 - Add `println!`-like heuristic to the `fail` attribute #3067
633 - Handle itemized items inside comments #3083
634 - Add `format_doc_comments` configuration option to control the formatting of code snippets inside comments #3089
635
636 ### Changed
637
638 - Makes brace behavior consistent with empty bodies for traits and impls 2727d41
639 - Consider a multi-lined array as a block-like expression #3969
640 - Improve formatting of strings #3073
641 - Get rid of extra commas in Visual struct literal formatting #3077
642 - Update rustc-ap-rustc_target to 274.0.0, rustc-ap-syntax to 274.0.0, and rustc-ap-syntax_pos to 274.0.0
643 - Format macro calls with item-like arguments #3080
644 - Avoid control flow expressions conditions to go multi line ef59b34
645 - Simplify multi-lining binop expressions #3101
646
647 ### Fixed
648
649 - Do not format a code block in documentation if it is annotated with ignore or text 2bcc3a9
650 - Fix inconsistent overflow behavior in Visual style #3078
651 - Fix corner cases of the string formatting implementation #3083
652 - Do not add parens around lifetimes 0ac68c9
653 - Catch parser panic in format_snippet 8c4e92a
654
655 ## [0.99.5] 2018-09-25
656
657 ### Added
658
659 - Handle leading module separator for 2018 Edition #2952
660 - Add configuration option `normalize_doc_attributes`: convert doc attributes to comments #3002
661
662 ### Changed
663
664 - Accept 2015 and 2018 instead of Edition2015 and Edition2018 for edition option eec7436
665 - Support platforms without a timer 46e2a2e
666 - Update rustc-ap-rustc_target to 263.0.0, rustc-ap-syntax to 263.0.0, and rustc-ap-syntax_pos to 263.0.0
667
668 ### Fixed
669
670 - Format of attributes with commas #2971
671 - Fix optional arg condensing #2972
672 - Improve formatting of long function parameters #2981
673 - Fix formatting of raw string literals #2983
674 - Handle chain with try operators with spaces #2986
675 - Use correct shape in Visual tuple rewriting #2987
676 - Impove formatting of arguments with `visual_style = "Visual"` option #2988
677 - Change `print_diff` to output the correct line number 992b179
678 - Propagate errors about failing to rewrite a macro 6f318e3
679 - Handle formatting of long function signature #3010
680 - Fix indent computation of a macro with braces c3edf6d
681 - Format generics on associated types #3035
682 - Incorrect indentation of multiline block match expression #3042
683 - Fix bug in import where two consecutive module separators were possible 98a0ef2
684 - Prevent right-shifting of block comments with bare lines 5fdb6db
685
686 ## [0.99.4] 2018-08-27
687
688 ### Added
689
690 - Handle formatting of underscore imports #2951
691 - Handle formatting of try blocks #2965
692
693 ### Changed
694
695 - Update rustc-ap-rustc_target to 237.0.0, rustc-ap-syntax to 237.0.0, and rustc-ap-syntax_pos to 237.0.0 ca19c9a
696 - Consider `dev` channel as nightly for unstable features #2948
697
698 ### Fixed
699
700 - Fix formatting of patterns with ellipsis # 2942
701
702 ## [0.99.3] 2018-08-23
703
704 ### Added
705
706 - Use path attribute when searching for modules #2901
707 - Expose FileLines JSON representation to allow external libraries to use the file_lines option #2915
708
709 ### Changed
710
711 - Replace '--conifig-help' with '--config=help' cb10e06
712 - Improve formatting of slice patterns #2912
713
714 ### Fixed
715
716 - Format chains with comment #2899
717 - Fix indentation of formatted macro body #2920
718 - Fix indentation of block comments f23e6aa
719
720 ## [0.99.2] 2018-08-07
721
722 ### Changed
723
724 - Update rustc-ap-rustc_target to 218.0.0, rustc-ap-syntax to 218.0.0, and rustc-ap-syntax_pos to 218.0.0 5c9a2b6
725 - Combine function-like attributes #2900
726
727 ### Fixed
728
729 - Explicitly handle semicolon after the item in statement position d96e3ca
730 - Fix parsing '#'-hiding of rustdoc 2eca09e
731
732 ## [0.99.1] 2018-08-04
733
734 ### Fixed
735
736 - fix use statements ordering when a number is present 1928ae7
737
738 ## [0.99.0] 2018-08-03
739
740 - 1.0 RC release
741
742 ### Changed
743
744 - Clarification in README.md 30fe66b
745
746 ## [0.9.0] 2018-08-01
747
748 ### Added
749
750 - Handle raw identifiers 3027c21
751 - Format async closure 60ce411
752 - Add max_width option for all heuristics c2ae39e
753 - Add config option `format_macro_matchers` to format the metavariable matching patterns in macros 79c5ee8
754 - Add config option `format_macro_bodies` to format the bodies of macros 79c5ee8
755 - Format exitential type fc307ff
756 - Support raw identifiers in struct expressions f121b1a
757 - Format Async block and async function 0b25f60
758
759 ### Changed
760
761 - Update rustc-ap-rustc_target to 211.0.0, rustc-ap-syntax to 211.0.0, and rustc-ap-syntax_pos to 211.0.0
762 - Put each nested import on its own line while putting non-nested imports on the same line as much as possible 42ab258
763 - Respect `empty_item_single_line` config option when formatting empty impls. Put the `where` on its own line to improve readability #2771
764 - Strip leading `|` in match arm patterns 1d4b988
765 - Apply short function call heuristic to attributes 3abebf9
766 - Indent a match guard if the pattern is multiline be4d37d
767 - Change default newline style to `Native` 9d8f381
768 - Improve formatting of series of binop expressions a4cdb68
769 - Trigger an internal error if we skip formatting due to a lost comment b085113
770 - Refactor chain formatting #2838
771
772 ### Fixed
773
774 - Do not insert spaces around braces with empty body or multiple lines 2f65852
775 - Allow using mixed layout with comments #2766
776 - Handle break labels #2726
777 - fix rewrite_string when a line feed is present 472a2ed
778 - Fix an anomaly with comments and array literals b28a0cd
779 - Check for comments after the `=>` in a match arm 6899471
780
781 ## [0.8.0,0.8.1,0.8.2] 2018-05-28
782
783 ### Added
784
785 - Use scoped attributes for skip attribute https://github.com/rust-lang/rustfmt/pull/2703
786
787 ### Changed
788
789 - Comment options `wrap_comments` and `normalize_comments` are reverted back to unstable 416bc4c
790 - Stabilise `reorder_imports` and `reorder_modules` options 7b6d2b4
791 - Remove `spaces_within_parens_and_brackets` option d726492
792 - Stabilise shorthand options: `use_try_shorthand`, `use_field_init_shorthand`, and `force_explicit_abi` 8afe367
793 - Stabilise `remove_nested_parens` and set default to true a70f716
794 - Unstabilise `unstable_features` dd9c15a
795 - Remove `remove_blank_lines_at_start_or_end_of_block` option 2ee8b0e
796 - Update rustc-ap-syntax to 146.0.0 and rustc-ap-rustc_target to 146.0.0 2c275a2
797 - Audit the public API #2639
798
799 ### Fixed
800
801 - Handle code block in doc comment without rust prefix f1974e2
802
803 ## [0.7.0] 2018-05-14
804
805 ### Added
806
807 - Add integration tests against crates in the rust-lang-nursery c79f39a
808
809 ### Changed
810
811 - Update rustc-ap-syntax to 128.0.0 and ustc-ap-rustc_target to 128.0.0 195395f
812 - Put operands on its own line when each fits in a single line f8439ce
813 - Improve CLI options 55ac062 1869888 798bffb 4d9de48 eca7796 8396da1 5d9f5aa
814
815 ### Fixed
816
817 - Use correct line width for list attribute 61a401a
818 - Avoid flip-flopping impl items when reordering them 37c216c
819 - Formatting breaks short lines when max_width is less than 100 9b36156
820 - Fix variant "Mixed" of imports_layout option 8c8676c
821 - Improve handling of long lines f885039
822 - Fix up lines exceeding max width 51c07f4
823 - Fix handling of modules in non_modrs_mods style cf573e8
824 - Do not duplicate attributes on use items e59ceaf
825 - Do not insert an extra brace in macros with native newlines 4c9ef93
826
827 ## [0.6.1] 2018-05-01
828
829 ### Changed
830
831 - Change the default value of imports_indent to IndentStyle::Block https://github.com/rust-lang/rustfmt/pull/2662
832
833 ### Fixed
834
835 - Handle formatting of auto traits 5b5a72c
836 - Use consistent formatting for empty enum and struct https://github.com/rust-lang/rustfmt/pull/2656
837
838 ## [0.6.0] 2018-04-20
839
840 ### Changed
841
842 - Improve public API 8669004
843
844 ## [0.5.0] 2018-04-20
845
846 ### Added
847
848 - Add `verbose-diff` CLI option 5194984
849
850 ### Changed
851
852 - Update rustc-ap-syntax to 103.0.0 dd807e2
853 - Refactor to make a sensible public API ca610d3
854
855 ### Fixed
856
857 - Add spaces between consecutive `..` `..=` 61d29eb
858
859 ## [0.4.2] 2018-04-12
860
861 ### Added
862
863 - Handle binary operators and lifetimes 0fd174d
864 - Add reorder_impl_items config option 94f5a05
865 - Add `--unstable-features` CLI option to list unstable options from the `--help` output 8208f8a
866 - Add merge_imports config option 5dd203e
867
868 ### Changed
869
870 - Format macro arguments with vertical layout ec71459
871 - Reorder imports by default 164cf7d
872 - Do not collapse block around expr with condition on match arm 5b9b7d5
873 - Use vertical layout for complex attributes c77708f
874 - Format array using heuristics for function calls 98c6f7b
875 - Implement stable ordering for impl items with the the following item priority: type, const, macro, then method fa80ddf
876 - Reorder imports by default 164cf7d
877 - Group `extern crate` by default 3a138a2
878 - Make `error_on_line_overflow` false by default f146711
879 - Merge imports with the same prefix into a single nested import 1954513
880 - Squash the various 'reorder imports' option into one 911395a
881
882 ### Fixed
883
884 - Print version is missing the channel ca6fc67
885 - Do not add the beginning vert to the match arm 1e1d9d4
886 - Follow indent style config when formatting attributes efd295a
887 - Do not insert newline when item is empty a8022f3
888 - Do not indent or unindent inside string literal ec1907b
889
890 ## [0.4.1] 2018-03-16
891
892 ### Added
893
894 - Add `ignore` configuration option.
895 - Add `license_template_path` configuration option.
896 - Format `lazy_static!`.
897
898 ### Fixed
899
900 - Fix formatting bugs.
901 - Fix setting `reorder_modules` removing inline modules.
902 - Format attributes on block expressions.
903 - Support `dyn trait` syntax.
904 - Support multiple patterns in `if let` and `while let`.
905 - Support a pattern with parentheses.
906
907 ## [0.4.0] 2018-03-02
908
909 ### Changed
910
911 - Do not print verbose outputs when formatting with stdin.
912 - Preserve trailing whitespaces in doc comments.
913 - Scale the values of width heuristics by `max_width`.
914
915 ### Fixed
916
917 - Do not reorder items with `#[macro_use]`.
918 - Fix formatting bugs.
919 - Support the beginning `|` on a match arm.
920
921 ## [0.3.8] 2018-02-04
922
923 ### Added
924
925 - Format (or at least try to format) `macro_rules!`.
926
927 ## [0.3.7] 2018-02-01
928
929 ### Added
930
931 - Add `use_field_init_shorthand` config option.
932 - Add `reorder_modules` configuration option.
933
934 ## [0.3.6] 2018-01-18
935
936 ### Fixed
937
938 - Fix panicking on formatting certain macros (#2371).
939
940 ## [0.3.5] 2018-01-15
941
942 ### Changed
943
944 - Format code block in comments when `wrap_comments` is set to `true`.
945 - Remove `same_line_attributes` configuration option.
946 - Rename `git-fmt` to `git-rustfmt`.
947
948 ### Fixed
949
950 - Rustup to `rustc 1.25.0-nightly (e6072a7b3 2018-01-13)`.
951 - Fix formatting bugs.
952
953 ## [0.3.4] 2017-12-23
954
955 ### Added
956
957 - Add `--version` flag to `cargo-fmt`, allow `cargo fmt --version`.
958
959 ### Fixed
960
961 - Rustup to `rustc 1.24.0-nightly (5165ee9e2 2017-12-22)`.
962
963 ## [0.3.3] 2017-12-22
964
965 ### Added
966
967 - Format trait aliases.
968
969 ### Changed
970
971 - `cargo fmt` will format every workspace member.
972
973 ### Fixed
974
975 - Rustup to `rustc 1.24.0-nightly (250b49205 2017-12-21)`
976 - Fix formatting bugs.
977
978 ## [0.3.2] 2017-12-15
979
980 ### Changed
981
982 - Warn when unknown configuration option is used.
983
984 ### Fixed
985
986 - Rustup to `rustc 1.24.0-nightly (0077d128d 2017-12-14)`.
987
988 ## [0.3.1] 2017-12-11
989
990 ### Added
991
992 - Add `error_on_unformatted` configuration option.
993 - Add `--error-on-unformatted` command line option.
994
995 ### Changed
996
997 - Do not report formatting errors on comments or strings by default.
998 - Rename `error_on_line_overflow_comments` to `error_on_unformatted`.
999
1000 ### Fixed
1001
1002 - Fix formatting bugs.
1003 - Fix adding a trailing whitespace inside code block when `wrap_comments = true`.
1004
1005 ## [0.3.0] 2017-12-11
1006
1007 ### Added
1008
1009 - Support nested imports.
1010
1011 ### Changed
1012
1013 - Do not report errors on skipped items.
1014 - Do not format code block inside comments when `wrap_comments = true`.
1015 - Keep vertical spaces between items within range.
1016 - Format `format!` and its variants using compressed style.
1017 - Format `write!` and its variants using compressed style.
1018 - Format **simple** array using compressed style.
1019
1020 ### Fixed
1021
1022 - Fix `rustfmt --package package_name` not working properly.
1023 - Fix formatting bugs.
1024
1025 ## [0.2.17] 2017-12-03
1026
1027 ### Added
1028
1029 - Add `blank_lines_lower_bound` and `blank_lines_upper_bound` configuration options.
1030
1031 ### Changed
1032
1033 - Combine configuration options related to width heuristic into `width_heuristic`.
1034 - If the match arm's body is `if` expression, force to use block.
1035
1036 ### Fixed
1037
1038 - Fix `cargo fmt --all` being trapped in an infinite loop.
1039 - Fix many formatting bugs.
1040
1041 ### Removed
1042
1043 - Remove legacy configuration options.
1044
1045 ## [0.2.16] 2017-11-21
1046
1047 ### Added
1048
1049 - Remove empty lines at the beginning of the file.
1050 - Soft wrapping on doc comments.
1051
1052 ### Changed
1053
1054 - Break before `|` when using multiple lines for match arm patterns.
1055 - Combine `control_style`, `where_style` and `*_indent` config options into `indent_style`.
1056 - Combine `item_brace_style` and `fn_brace_style` config options into `brace_style`.
1057 - Combine config options related spacing around colons into `space_before_colon` and `space_after_colon`.
1058
1059 ### Fixed
1060
1061 - Fix many bugs.
1062
1063 ## [0.2.15] 2017-11-08
1064
1065 ### Added
1066
1067 - Add git-fmt tool
1068 - `where_single_line` configuration option.
1069
1070 ### Changed
1071
1072 - Rename `chain_one_line_max` to `chain_width`.
1073 - Change the suffix of indent-related configuration options to `_indent`.
1074
1075 ## [0.2.14] 2017-11-06
1076
1077 ### Fixed
1078
1079 - Rustup to the latest nightly.
1080
1081 ## [0.2.13] 2017-10-30
1082
1083 ### Fixed
1084
1085 - Rustup to the latest nightly.
1086
1087 ## [0.2.12] 2017-10-29
1088
1089 ### Fixed
1090
1091 - Fix a bug that `cargo fmt` hangs forever.
1092
1093 ## [0.2.11] 2017-10-29
1094
1095 ### Fixed
1096
1097 - Fix a bug that `cargo fmt` crashes.
1098
1099 ## [0.2.10] 2017-10-28
1100
1101 ## [0.2.9] 2017-10-16
1102
1103 ## [0.2.8] 2017-09-28
1104
1105 ## [0.2.7] 2017-09-21
1106
1107 ### Added
1108
1109 - `binop_separator` configuration option (#1964).
1110
1111 ### Changed
1112
1113 - Use horizontal layout for function call with a single argument.
1114
1115 ### Fixed
1116
1117 - Fix panicking when calling `cargo fmt --all` (#1963).
1118 - Refactorings & faster rustfmt.
1119
1120 ## [0.2.6] 2017-09-14
1121
1122 ### Fixed
1123
1124 - Fix a performance issue with nested block (#1940).
1125 - Refactorings & faster rustfmt.
1126
1127 ## [0.2.5] 2017-08-31
1128
1129 ### Added
1130
1131 - Format and preserve attributes on statements (#1933).
1132
1133 ### Fixed
1134
1135 - Use getters to access `Span` fields (#1899).
1136
1137 ## [0.2.4] 2017-08-30
1138
1139 ### Added
1140
1141 - Add support for `Yield` (#1928).
1142
1143 ## [0.2.3] 2017-08-30
1144
1145 ### Added
1146
1147 - `multiline_closure_forces_block` configuration option (#1898).
1148 - `multiline_match_arm_forces_block` configuration option (#1898).
1149 - `merge_derives` configuration option (#1910).
1150 - `struct_remove_empty_braces` configuration option (#1930).
1151 - Various refactorings.
1152
1153 ### Changed
1154
1155 - Put single-lined block comments on the same line with list-like structure's item (#1923).
1156 - Preserve blank line between doc comment and attribute (#1925).
1157 - Put the opening and the closing braces of enum and struct on the same line, even when `item_brace_style = "AlwaysNextLine"` (#1930).
1158
1159 ### Fixed
1160
1161 - Format attributes on `ast::ForeignItem` and take max width into account (#1916).
1162 - Ignore empty lines when calculating the shortest indent width inside macro with braces (#1918).
1163 - Handle tabs properly inside macro with braces (#1918).
1164 - Fix a typo in `compute_budgets_for_args()` (#1924).
1165 - Recover comment between keyword (`impl` and `trait`) and `{` which used to get removed (#1925).
1166
1167
1168 [install-from-source]: https://github.com/rust-lang/rustfmt#installing-from-source