Skip to content

Commit 714e904

Browse files
Merge commit 'efa8f5521d3813cc897ba29ea0ef98c7aef66bb6' into rustfmt-subtree
2 parents 42983a2 + efa8f55 commit 714e904

File tree

143 files changed

+2902
-918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+2902
-918
lines changed

src/tools/rustfmt/.github/workflows/upload-assets.yml

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: upload
22

33
on:
4+
push:
45
release:
56
types: [created]
7+
workflow_dispatch:
68

79
jobs:
810
build-release:
@@ -14,42 +16,40 @@ jobs:
1416
- build: linux-x86_64
1517
os: ubuntu-latest
1618
rust: nightly
19+
target: x86_64-unknown-linux-gnu
1720
- build: macos-x86_64
1821
os: macos-latest
1922
rust: nightly
23+
target: x86_64-apple-darwin
2024
- build: windows-x86_64-gnu
2125
os: windows-latest
2226
rust: nightly-x86_64-gnu
27+
target: x86_64-pc-windows-gnu
2328
- build: windows-x86_64-msvc
2429
os: windows-latest
2530
rust: nightly-x86_64-msvc
31+
target: x86_64-pc-windows-msvc
2632
runs-on: ${{ matrix.os }}
2733
steps:
2834
- uses: actions/checkout@v2
2935

30-
- name: Install Rust
31-
uses: actions-rs/toolchain@v1
32-
with:
33-
profile: minimal
34-
toolchain: ${{ matrix.rust }}
35-
override: true
36+
# Run build
37+
- name: install rustup
38+
run: |
39+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
40+
sh rustup-init.sh -y --default-toolchain none
41+
rustup target add ${{ matrix.target }}
3642
3743
- name: Add mingw64 to path for x86_64-gnu
3844
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
3945
if: matrix.rust == 'nightly-x86_64-gnu'
4046
shell: bash
4147

42-
- name: Install cargo-make
43-
uses: actions-rs/cargo@v1
44-
with:
45-
command: install
46-
args: --force cargo-make
47-
4848
- name: Build release binaries
4949
uses: actions-rs/cargo@v1
5050
with:
51-
command: make
52-
args: release
51+
command: build
52+
args: --release
5353

5454
- name: Build archive
5555
shell: bash
@@ -70,6 +70,7 @@ jobs:
7070
fi
7171
7272
- name: Upload Release Asset
73+
if: github.event_name == 'release'
7374
uses: actions/upload-release-asset@v1
7475
env:
7576
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

src/tools/rustfmt/.github/workflows/windows.yml

-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ jobs:
5454
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
5555
shell: bash
5656

57-
- name: cargo-make
58-
run: cargo install --force cargo-make
59-
6057
- name: build
6158
run: |
6259
rustc -Vv

src/tools/rustfmt/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Generated by Cargo
66
# will have compiled files and executables
77
/target
8+
tests/cargo-fmt/**/target
89

910
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
1011
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock

src/tools/rustfmt/CHANGELOG.md

+67
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,73 @@
22

33
## [Unreleased]
44

5+
## [1.4.38] 2021-10-20
6+
7+
### Changed
8+
9+
- Switched from `rustc-ap-*` crates to `rustc_private` for consumption model of rustc internals
10+
- `annotate-snippets` updated to v0.8 [PR #4762](https://github.com/rust-lang/rustfmt/pull/4762)
11+
- 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)
12+
- Improved formatting of long slice patterns [#4530](https://github.com/rust-lang/rustfmt/issues/4530)
13+
- **Note you must have `version = Two` in your configuration to take advantage of the new formatting**
14+
- 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)
15+
- 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)
16+
- 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])
17+
- Addressed various clippy and rustc warnings
18+
19+
20+
### Fixed
21+
22+
- 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)
23+
- Nested out-of-line mods are again parsed and formatted [#4874](https://github.com/rust-lang/rustfmt/issues/4874)
24+
- Accepts `2021` for edition value from rustfmt command line [PR #4847](https://github.com/rust-lang/rustfmt/pull/4847)
25+
- Unstable command line options are no longer displayed in `--help` text on stable [PR #4798](https://github.com/rust-lang/rustfmt/issues/4798)
26+
- Stopped panicking on patterns in match arms which start with non-ascii characters [#4868](https://github.com/rust-lang/rustfmt/issues/4868)
27+
- Stopped stripping defaults on const params [#4816](https://github.com/rust-lang/rustfmt/issues/4816)
28+
- Fixed issue with dropped content with GAT aliases with self bounds in impls [#4911](https://github.com/rust-lang/rustfmt/issues/4911)
29+
- Stopped removing generic args on associated type constraints [#4943](https://github.com/rust-lang/rustfmt/issues/4943)
30+
- Stopped dropping visibility on certain trait and impl items [#4960](https://github.com/rust-lang/rustfmt/issues/4960)
31+
- 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)
32+
- Fixed bug in line width calculation that was causing specious formatting of certain patterns [#4031](https://github.com/rust-lang/rustfmt/issues/4031)
33+
- **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**
34+
- 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)
35+
- Resolved idempotency issue with extern body elements [#4963](https://github.com/rust-lang/rustfmt/issues/4963)
36+
- 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)
37+
- 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)
38+
- Fixed bug in cases where derive attributes started with a block style comment [#4984](https://github.com/rust-lang/rustfmt/issues/4984)
39+
- 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)
40+
- 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)
41+
- Handles tuple structs that have explicit visibilities and start with a block style comment [#5011](https://github.com/rust-lang/rustfmt/issues/5011)
42+
- Handles leading line-style comments in certain types of macro calls [#4615](https://github.com/rust-lang/rustfmt/issues/4615)
43+
44+
45+
### Added
46+
- Granular width heuristic options made available for user control [PR #4782](https://github.com/rust-lang/rustfmt/pull/4782). This includes the following:
47+
- [`array_width`](https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#array_width)
48+
- [`attr_fn_like_width`](https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#attr_fn_like_width)
49+
- [`chain_width`](https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#chain_width)
50+
- [`fn_call_width`](https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#fn_call_width)
51+
- [`single_line_if_else_max_width`](https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#single_line_if_else_max_width)
52+
- [`struct_lit_width`](https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#struct_lit_width)
53+
- [`struct_variant_width`](https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#struct_variant_width)
54+
55+
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
56+
[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)
57+
58+
- 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)
59+
- 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)
60+
- 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)
61+
62+
See the section on the configuration site for more information
63+
https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#hex_literal_case
64+
65+
- `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)
66+
67+
### Install/Download Options
68+
- **rustup (nightly)** - *pending*
69+
- **GitHub Release Binaries** - [Release v1.4.38](https://github.com/rust-lang/rustfmt/releases/tag/v1.4.38)
70+
- **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]
71+
572
## [1.4.37] 2021-04-03
673

774
### Changed

0 commit comments

Comments
 (0)