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