|
2 | 2 |
|
3 | 3 | ## [Unreleased]
|
4 | 4 |
|
| 5 | + |
| 6 | +## [1.7.0] 2023-10-22 |
| 7 | + |
| 8 | +### Fixed |
| 9 | + |
| 10 | +- Sometimes when `format_code_in_doc_comments=true` was set some line comments were converted to block comments [#5533](https://github.com/rust-lang/rustfmt/issues/5533) |
| 11 | +- rustfmt will no longer remove the braces in match arms when the block has a labeled [#5676](https://github.com/rust-lang/rustfmt/issues/5676) |
| 12 | + ```rust |
| 13 | + fn main() { |
| 14 | + match true { |
| 15 | + true => 'a: { |
| 16 | + break 'a |
| 17 | + } |
| 18 | + _ => (), |
| 19 | + } |
| 20 | + } |
| 21 | + ``` |
| 22 | +- Calling methods on float literals ending in `.` will now be wrapped in parenthesis. e.g. `0. .to_string()` will be formatted as `(0.).to_string()` [#5791](https://github.com/rust-lang/rustfmt/issues/5791) |
| 23 | +- Prevent ICE when formatting empty `macro_rules!` branch [#5730](https://github.com/rust-lang/rustfmt/issues/5730) |
| 24 | + ```rust |
| 25 | + macro_rules! statement { |
| 26 | + () => {;}; |
| 27 | + } |
| 28 | + ``` |
| 29 | +- Prevent ICE when formatting `vec!{}` [#5735](https://github.com/rust-lang/rustfmt/issues/5735) |
| 30 | +- Prevent internal trailing whitespace error when formatting an empty `macro_rules!` defintion e.g. `macro_rules! foo {}` [#5882](https://github.com/rust-lang/rustfmt/issues/5882) |
| 31 | +- Formatting doc comment lines that start with `.` or `)` won't be treated as ordered markdown lists because `.` or `)` must be preceded by a number to start an ordered markdown list [#5835](https://github.com/rust-lang/rustfmt/pull/5835) |
| 32 | +- Add parenthesis around closures when they're used as method receives, don't have a block body, and end with `.` [#4808](https://github.com/rust-lang/rustfmt/issues/4808) |
| 33 | + ```rust |
| 34 | + fn main() { |
| 35 | + || (10.).method(); |
| 36 | + (|| ..).method(); |
| 37 | + (|| 1..).method(); |
| 38 | + } |
| 39 | + ``` |
| 40 | +- Prevent removing `for<T>` when using the [`#![feature(non_lifetime_binders)]`](https://github.com/rust-lang/rust/issues/108185) [#5721](https://github.com/rust-lang/rustfmt/issues/5721) |
| 41 | + ```rust |
| 42 | + #![feature(non_lifetime_binders)] |
| 43 | + #![allow(incomplete_features)] |
| 44 | + |
| 45 | + trait Other<U: ?Sized> {} |
| 46 | + |
| 47 | + trait Trait<U> |
| 48 | + where |
| 49 | + for<T> U: Other<T> {} |
| 50 | + ``` |
| 51 | +- Fix various issues with comments in imports [#5852](https://github.com/rust-lang/rustfmt/issues/5852) [#4708](https://github.com/rust-lang/rustfmt/issues/4708) [#3984](https://github.com/rust-lang/rustfmt/issues/3984) |
| 52 | +- When setting `version = Two` newlines between where clause bounds will be removed [#5655](https://github.com/rust-lang/rustfmt/issues/5655) |
| 53 | + ```rust |
| 54 | + fn foo<T>(_: T) |
| 55 | + where |
| 56 | + T: std::fmt::Debug, |
| 57 | + T: std::fmt::Display, |
| 58 | + { |
| 59 | + } |
| 60 | + ``` |
| 61 | +- Improve formatting of `let-else` statements that have leading attributes When setting `version = Two` [#5901](https://github.com/rust-lang/rustfmt/issues/5901) |
| 62 | +- Prevent comment duplication in expressions wrapped in parenthesis. [#5871](https://github.com/rust-lang/rustfmt/issues/5871) |
| 63 | +- Adjust the span derivation used when rewriting const generics. The incorrect span derivation lead to invalid code after reformatting. [#5935](https://github.com/rust-lang/rustfmt/issues/5935) |
| 64 | + |
| 65 | + |
| 66 | +### Changed |
| 67 | + |
| 68 | +- rustfmt no longer removes explicit `Rust` ABIs. e.g `extern "Rust" fn im_a_rust_fn() {}` [#5701](https://github.com/rust-lang/rustfmt/issues/5701) |
| 69 | +- Setting `trailing_semicolon = false` will only remove trailing `;` on the last expression in a block [#5797](https://github.com/rust-lang/rustfmt/issues/5797) |
| 70 | +- Update the format of `cargo help fmt` to be more consistent with other standard commands [#5908](https://github.com/rust-lang/rustfmt/pull/5908) |
| 71 | + |
| 72 | +### Added |
| 73 | + |
| 74 | +- Users can now set `skip_macro_invocations` in `rustfmt.toml` [#5816](https://github.com/rust-lang/rustfmt/issues/5816) |
| 75 | +- Adds initial support for formatting `let-chains`. **`let-chains` are still a nightly feature and their formatting is subject to change** [#5910](https://github.com/rust-lang/rustfmt/pull/5910). Formatting was implemented following the rules outlined in [rust-lang/rust#110568](https://github.com/rust-lang/rust/pull/110568) |
| 76 | + |
| 77 | +### Misc |
| 78 | + |
| 79 | +- Support the experimental `dyn*` syntax, enabled by `#![feature(dyn_star)]` [#5542](https://github.com/rust-lang/rustfmt/issues/5542) |
| 80 | +- Replace `unicode_categories` dependency with `unicode-properties` [#5864](https://github.com/rust-lang/rustfmt/pull/5864) |
| 81 | + |
| 82 | +## [1.6.0] 2023-07-02 |
| 83 | + |
| 84 | +### Added |
| 85 | + |
| 86 | +- Support for formatting let-else statements [#5690] |
| 87 | +- New config option, `single_line_let_else_max_width`, that allows users to configure the maximum length of single line `let-else` statements. `let-else` statements that otherwise meet the requirements to be formatted on a single line will have their divergent`else` block formatted over multiple lines if they exceed this length [#5684] |
| 88 | + |
| 89 | +[#5690]: https://github.com/rust-lang/rustfmt/pull/5690 |
| 90 | +[#5684]: https://github.com/rust-lang/rustfmt/issues/5684 |
| 91 | + |
| 92 | +## [1.5.3] 2023-06-20 |
| 93 | + |
| 94 | +### Fixed |
| 95 | + |
| 96 | +- When formatting doc comments with `wrap_comments = true` rustfmt will no longer wrap markdown tables [#4210](https://github.com/rust-lang/rustfmt/issues/4210) |
| 97 | +- Properly handle wrapping comments that include a numbered list in markdown [#5416](https://github.com/rust-lang/rustfmt/issues/5416) |
| 98 | +- Properly handle markdown sublists that utilize a `+` [#4041](https://github.com/rust-lang/rustfmt/issues/4041) |
| 99 | +- rustfmt will no longer use shorthand initialization when rewriting a tuple struct even when `use_field_init_shorthand = true` as this leads to code that could no longer compile. |
| 100 | + Take the following struct as an example `struct MyStruct(u64);`. rustfmt will no longer format `MyStruct { 0: 0 }` as `MyStruct { 0 }` [#5488](https://github.com/rust-lang/rustfmt/issues/5488) |
| 101 | +- rustfmt no longer panics when formatting an empty code block in a doc comment with `format_code_in_doc_comments = true` [#5234](https://github.com/rust-lang/rustfmt/issues/5234). For example: |
| 102 | + ```rust |
| 103 | + /// ``` |
| 104 | + /// |
| 105 | + /// ``` |
| 106 | + fn main() {} |
| 107 | + ``` |
| 108 | +- rustfmt no longer incorrectly duplicates the where clause bounds when using const expression in where clause bounds with feature `#![feature(generic_const_exprs)]` [#5691](https://github.com/rust-lang/rustfmt/issues/5691). e.g.: |
| 109 | + ```rust |
| 110 | + struct S<const C: usize> |
| 111 | + where |
| 112 | + [(); { num_slots!(C) }]:, { |
| 113 | + // code ... |
| 114 | + } |
| 115 | + ``` |
| 116 | +- Prevent ICE when parsing invalid attributes in `cfg_if!` macros [#5728](https://github.com/rust-lang/rustfmt/issues/5728), [#5729](https://github.com/rust-lang/rustfmt/issues/5729) |
| 117 | +- rustfmt no longer loses comments placed between a doc comment and generic params [#5320](https://github.com/rust-lang/rustfmt/issues/5320) |
| 118 | +- Handle explicit discriminants in enums with comments present [#5686](https://github.com/rust-lang/rustfmt/issues/5686) |
| 119 | + |
| 120 | +### Changed |
| 121 | + |
| 122 | +- Users can now control whether rustc parser errors are displayed with color using rustfmt's `--color` option. To disable colored errors pass `--color=Never` to rustfmt [#5717](https://github.com/rust-lang/rustfmt/issues/5717) |
| 123 | + |
| 124 | + |
| 125 | +### Added |
| 126 | + |
| 127 | +- rustfmt now recognises `+` as the start of a markdown list, and won't incorrectly wrap sublists that begin with `+` when formatting doc comments with `wrap_comments = true` [#5560](https://github.com/rust-lang/rustfmt/pull/5560) |
| 128 | + |
| 129 | +### Misc |
| 130 | + |
| 131 | +- Update various dependencies, including `syn`, `cargo_metadata`, `env_logger`, and `toml` |
| 132 | + |
| 133 | +## [1.5.2] 2023-01-24 |
| 134 | + |
| 135 | +### Fixed |
| 136 | + |
| 137 | +- Resolve issue when comments are found within const generic defaults in unit structs [#5668](https://github.com/rust-lang/rustfmt/issues/5668) |
| 138 | +- Resolve issue when block comments are found within trait generics [#5358](https://github.com/rust-lang/rustfmt/issues/5358) |
| 139 | +- Correctly handle alignment of comments containing unicode characters [#5504](https://github.com/rust-lang/rustfmt/issues/5504) |
| 140 | +- Properly indent a single generic bound that requires being written across multiple lines [#4689](https://github.com/rust-lang/rustfmt/issues/4689) (n.b. this change is version gated and will only appear when the `version` configuration option is set to `Two`) |
| 141 | + |
| 142 | +### Changed |
| 143 | + |
| 144 | +- Renamed `fn_args_layout` configuration option to `fn_params_layout` [#4149](https://github.com/rust-lang/rustfmt/issues/4149). Note that `fn_args_layout` has only been soft deprecated: `fn_args_layout` will continue to work without issue, but rustfmt will display a warning to encourage users to switch to the new name |
| 145 | + |
| 146 | +### Added |
| 147 | + |
| 148 | +- New configuration option (`skip_macro_invocations`)[https://rust-lang.github.io/rustfmt/?version=master&search=#skip_macro_invocations] [#5347](https://github.com/rust-lang/rustfmt/pull/5347) that can be used to globally define a single enumerated list of macro calls that rustfmt should skip formatting. rustfmt [currently also supports this via a custom tool attribute](https://github.com/rust-lang/rustfmt#tips), however, these cannot be used in all contexts because [custom inner attributes are unstable](https://github.com/rust-lang/rust/issues/54726) |
| 149 | + |
| 150 | +### Misc |
| 151 | + |
| 152 | +- rustfmt now internally supports the ability to have both stable and unstable variants of a configuration option [#5378](https://github.com/rust-lang/rustfmt/issues/5378). This ability will allow the rustfmt team to make certain configuration options available on stable toolchains more quickly because we no longer have to wait for _every_ variant to be stable-ready before stabilizing _any_ variant. |
| 153 | + |
| 154 | +### Install/Download Options |
| 155 | +- **rustup (nightly)** - nightly-2023-01-24 |
| 156 | +- **GitHub Release Binaries** - [Release v1.5.2](https://github.com/rust-lang/rustfmt/releases/tag/v1.5.2) |
| 157 | +- **Build from source** - [Tag v1.5.2](https://github.com/rust-lang/rustfmt/tree/v1.5.2), see instructions for how to [install rustfmt from source][install-from-source] |
| 158 | + |
5 | 159 | ## [1.5.1] 2022-06-24
|
6 | 160 |
|
7 | 161 | **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.
|
|
30 | 184 |
|
31 | 185 | - 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 | 186 |
|
| 187 | +- Bumped the version for serveral dependencies. Most notably `dirs` `v2.0.1` -> `v4.0.0`. This changed the global user config directory on macOS from `$HOME/Library/Preferences` to `$HOME/Library/Application Support` [#5237](https://github.com/rust-lang/rustfmt/pull/5237) |
| 188 | + |
33 | 189 | ### Fixed
|
34 | 190 |
|
35 | 191 | - Remove duplicate imports when `imports_granularity` is set to `Item` [#4725](https://github.com/rust-lang/rustfmt/issues/4725)
|
|
0 commit comments