rustfmt v1.4.38 Release Notes
Release Date: 2021-10-20 // over 2 years ago-
๐ Changed
- Switched from
rustc-ap-*
crates torustc_private
for consumption model of rustc internals - โก๏ธ
annotate-snippets
updated to v0.8 PR #4762 - ๐ Greatly improved the performance of
cargo fmt
in large workspaces utilizing the--all
flag by updating to a newer version ofcargo_metadata
that leverages updatedcargo
output from v1.51+ PR #4997 - ๐ Improved formatting of long slice patterns #4530
- Note you must have
version = Two
in your configuration to take advantage of the new formatting
- Note you must have
- Stabilized
match_block_trailing_comma
configuration option #3380 - https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#match_block_trailing_comma - Stabilized
disable_all_formatting
configuration option #5026 - https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#disable_all_formatting - ๐ 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])
- โ Addressed various clippy and rustc warnings
๐ Fixed
- ๐ Resolved issue where specious whitespace would be inserted when a block style comment was terminated within string literal processing #4312
- ๐ Nested out-of-line mods are again parsed and formatted #4874
- ๐ป Accepts
2021
for edition value from rustfmt command line PR #4847 - ๐ป Unstable command line options are no longer displayed in
--help
text on stable PR #4798 - Stopped panicking on patterns in match arms which start with non-ascii characters #4868
- 0๏ธโฃ Stopped stripping defaults on const params #4816
- ๐ Fixed issue with dropped content with GAT aliases with self bounds in impls #4911
- Stopped removing generic args on associated type constraints #4943
- Stopped dropping visibility on certain trait and impl items #4960
- ๐ Fixed dropping of qualified paths in struct patterns #4908 and #5005
- ๐ Fixed bug in line width calculation that was causing specious formatting of certain patterns #4031
- 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
- ๐ Fixed bug where rustfmt would drop parameter attributes if they were too long in certain cases #4579
- Resolved idempotency issue with extern body elements #4963
- ๐ 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
- 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 - ๐ Fixed bug in cases where derive attributes started with a block style comment #4984
- Fixed issue where the struct rest could be lost when
struct_field_align_threshold
was enabled #4926 - ๐ Handles cases where certain control flow type expressions have comments between patterns/keywords and the pattern ident contains the keyword #5009
- ๐ Handles tuple structs that have explicit visibilities and start with a block style comment #5011
- ๐ Handles leading line-style comments in certain types of macro calls #4615
โ Added
- Granular width heuristic options made available for user control PR #4782. This includes the following:
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 https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#use_small_heuristics- ๐ New
One
variant added toimports_granularity
configuration option which can be used to reformat all imports into a single use statement #4669 - rustfmt will now skip files that are annotated with
@generated
at the top of the file #3958 ifformat_generated_files
option is set tofalse
(by default@generated
files are formatted) - New configuration option
hex_literal_case
that allows user to control the casing utilized for hex literals PR #4903
๐ See the section on the configuration site for more information https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#hex_literal_case
- ๐
cargo fmt
now directly supports the--check
flag, which means it's now possible to runcargo fmt --check
instead of the more verbosecargo fmt -- --check
#3888
Install/Download Options
- rustup (nightly) - pending
- ๐ GitHub Release Binaries - Release v1.4.38
- ๐ Build from source - Tag v1.4.38, see instructions for how to [install rustfmt from source][install-from-source]
- Switched from