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