Skip to content

Commit b2d45c0

Browse files
Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd66b46a863'
git-subtree-dir: src/tools/rustfmt git-subtree-mainline: e659b6d git-subtree-split: 7872306
2 parents e659b6d + 7872306 commit b2d45c0

File tree

1,265 files changed

+78073
-0
lines changed

Some content is hidden

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

1,265 files changed

+78073
-0
lines changed

src/tools/rustfmt/.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.rs]
15+
indent_size = 4
16+
17+
[tests/**/*.rs]
18+
charset = utf-8
19+
end_of_line = unset
20+
indent_size = unset
21+
indent_style = unset
22+
trim_trailing_whitespace = unset
23+
insert_final_newline = unset
24+
25+
[appveyor.yml]
26+
end_of_line = unset

src/tools/rustfmt/.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
* text=auto eol=lf
2+
tests/source/issue-3494/crlf.rs -text
3+
tests/source/comment_crlf_newline.rs -text
4+
tests/source/configs/enum_discrim_align_threshold/40.rs -text
5+
tests/target/issue-3494/crlf.rs -text
6+
tests/target/comment_crlf_newline.rs -text
7+
tests/target/configs/enum_discrim_align_threshold/40.rs -text
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: integration
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
8+
jobs:
9+
integration-tests:
10+
runs-on: ubuntu-latest
11+
name: ${{ matrix.integration }}
12+
strategy:
13+
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
14+
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
15+
# In order to prevent overusing too much of that 60 limit, we throttle the
16+
# number of rustfmt jobs that will run concurrently.
17+
max-parallel: 4
18+
fail-fast: false
19+
matrix:
20+
integration: [
21+
bitflags,
22+
error-chain,
23+
log,
24+
mdbook,
25+
packed_simd,
26+
rust-semverver,
27+
tempdir,
28+
futures-rs,
29+
rust-clippy,
30+
failure,
31+
]
32+
include:
33+
# Allowed Failures
34+
# Actions doesn't yet support explicitly marking matrix legs as allowed failures
35+
# https://github.community/t5/GitHub-Actions/continue-on-error-allow-failure-UI-indication/td-p/37033
36+
# https://github.community/t5/GitHub-Actions/Why-a-matrix-step-will-be-canceled-if-another-one-failed/td-p/30920
37+
# Instead, leverage `continue-on-error`
38+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
39+
#
40+
# Failing due to breaking changes in rustfmt 2.0 where empty
41+
# match blocks have trailing commas removed
42+
# https://github.com/rust-lang/rustfmt/pull/4226
43+
- integration: chalk
44+
allow-failure: true
45+
- integration: crater
46+
allow-failure: true
47+
- integration: glob
48+
allow-failure: true
49+
- integration: stdsimd
50+
allow-failure: true
51+
# Using old rustfmt configuration option
52+
- integration: rand
53+
allow-failure: true
54+
# Keep this as an allowed failure as it's fragile to breaking changes of rustc.
55+
- integration: rust-clippy
56+
allow-failure: true
57+
# Using old rustfmt configuration option
58+
- integration: packed_simd
59+
allow-failure: true
60+
# calebcartwright (2019-12-24)
61+
# Keeping this as an allowed failure since it was flagged as such in the TravisCI config, even though
62+
# it appears to have been passing for quite some time.
63+
# Original comment was: temporal build failure due to breaking changes in the nightly compiler
64+
- integration: rust-semverver
65+
allow-failure: true
66+
# Can be moved back to include section after https://github.com/rust-lang-nursery/failure/pull/298 is merged
67+
- integration: failure
68+
allow-failure: true
69+
70+
steps:
71+
- name: checkout
72+
uses: actions/checkout@v2
73+
74+
# Run build
75+
- name: install rustup
76+
run: |
77+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
78+
sh rustup-init.sh -y --default-toolchain none
79+
80+
- name: run integration tests
81+
env:
82+
INTEGRATION: ${{ matrix.integration }}
83+
TARGET: x86_64-unknown-linux-gnu
84+
run: ./ci/integration.sh
85+
continue-on-error: ${{ matrix.allow-failure == true }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: linux
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
name: (${{ matrix.target }}, nightly)
12+
strategy:
13+
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
14+
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
15+
# In order to prevent overusing too much of that 60 limit, we throttle the
16+
# number of rustfmt jobs that will run concurrently.
17+
max-parallel: 1
18+
fail-fast: false
19+
matrix:
20+
target: [
21+
x86_64-unknown-linux-gnu,
22+
]
23+
24+
steps:
25+
- name: checkout
26+
uses: actions/checkout@v2
27+
28+
# Run build
29+
- name: install rustup
30+
run: |
31+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
32+
sh rustup-init.sh -y --default-toolchain none
33+
rustup target add ${{ matrix.target }}
34+
35+
- name: build
36+
run: |
37+
rustc -Vv
38+
cargo -V
39+
cargo build
40+
41+
- name: test
42+
run: cargo test
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: mac
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources
11+
# macOS Catalina 10.15
12+
runs-on: macos-latest
13+
name: (${{ matrix.target }}, nightly)
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
target: [
18+
x86_64-apple-darwin,
19+
]
20+
21+
steps:
22+
- name: checkout
23+
uses: actions/checkout@v2
24+
25+
# Run build
26+
- name: install rustup
27+
run: |
28+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
29+
sh rustup-init.sh -y --default-toolchain none
30+
rustup target add ${{ matrix.target }}
31+
32+
- name: build
33+
run: |
34+
rustc -Vv
35+
cargo -V
36+
cargo build
37+
38+
- name: test
39+
run: cargo test
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: upload
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-release:
9+
name: build-release
10+
strategy:
11+
matrix:
12+
build: [linux-x86_64, macos-x86_64, windows-x86_64-gnu, windows-x86_64-msvc]
13+
include:
14+
- build: linux-x86_64
15+
os: ubuntu-latest
16+
rust: nightly
17+
- build: macos-x86_64
18+
os: macos-latest
19+
rust: nightly
20+
- build: windows-x86_64-gnu
21+
os: windows-latest
22+
rust: nightly-x86_64-gnu
23+
- build: windows-x86_64-msvc
24+
os: windows-latest
25+
rust: nightly-x86_64-msvc
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- uses: actions/checkout@v2
29+
30+
- name: Install Rust
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
profile: minimal
34+
toolchain: ${{ matrix.rust }}
35+
override: true
36+
37+
- name: Add mingw64 to path for x86_64-gnu
38+
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
39+
if: matrix.rust == 'nightly-x86_64-gnu'
40+
shell: bash
41+
42+
- name: Install cargo-make
43+
uses: actions-rs/cargo@v1
44+
with:
45+
command: install
46+
args: --force cargo-make
47+
48+
- name: Build release binaries
49+
uses: actions-rs/cargo@v1
50+
with:
51+
command: make
52+
args: release
53+
54+
- name: Build archive
55+
shell: bash
56+
run: |
57+
staging="rustfmt_${{ matrix.build }}_${{ github.event.release.tag_name }}"
58+
mkdir -p "$staging"
59+
60+
cp {README.md,Configurations.md,CHANGELOG.md,LICENSE-MIT,LICENSE-APACHE} "$staging/"
61+
62+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
63+
cp target/release/{rustfmt.exe,cargo-fmt.exe,rustfmt-format-diff.exe,git-rustfmt.exe} "$staging/"
64+
7z a "$staging.zip" "$staging"
65+
echo "ASSET=$staging.zip" >> $GITHUB_ENV
66+
else
67+
cp target/release/{rustfmt,cargo-fmt,rustfmt-format-diff,git-rustfmt} "$staging/"
68+
tar czf "$staging.tar.gz" "$staging"
69+
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
70+
fi
71+
72+
- name: Upload Release Asset
73+
uses: actions/upload-release-asset@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
with:
77+
upload_url: ${{ github.event.release.upload_url }}
78+
asset_path: ${{ env.ASSET }}
79+
asset_name: ${{ env.ASSET }}
80+
asset_content_type: application/octet-stream
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: windows
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: windows-latest
11+
name: (${{ matrix.target }}, nightly)
12+
strategy:
13+
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
14+
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
15+
# In order to prevent overusing too much of that 60 limit, we throttle the
16+
# number of rustfmt jobs that will run concurrently.
17+
max-parallel: 2
18+
fail-fast: false
19+
matrix:
20+
target: [
21+
i686-pc-windows-gnu,
22+
i686-pc-windows-msvc,
23+
x86_64-pc-windows-gnu,
24+
x86_64-pc-windows-msvc,
25+
]
26+
27+
steps:
28+
# The Windows runners have autocrlf enabled by default
29+
# which causes failures for some of rustfmt's line-ending sensitive tests
30+
- name: disable git eol translation
31+
run: git config --global core.autocrlf false
32+
- name: checkout
33+
uses: actions/checkout@v2
34+
35+
# Run build
36+
- name: Install Rustup using win.rustup.rs
37+
run: |
38+
# Disable the download progress bar which can cause perf issues
39+
$ProgressPreference = "SilentlyContinue"
40+
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
41+
.\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none
42+
del rustup-init.exe
43+
rustup target add ${{ matrix.target }}
44+
shell: powershell
45+
46+
- name: Add mingw32 to path for i686-gnu
47+
run: |
48+
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
49+
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
50+
shell: bash
51+
52+
- name: Add mingw64 to path for x86_64-gnu
53+
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
54+
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
55+
shell: bash
56+
57+
- name: cargo-make
58+
run: cargo install --force cargo-make
59+
60+
- name: build
61+
run: |
62+
rustc -Vv
63+
cargo -V
64+
cargo build
65+
shell: cmd
66+
67+
- name: test
68+
run: cargo test
69+
shell: cmd

src/tools/rustfmt/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
# Created by https://www.gitignore.io/api/rust
3+
4+
### Rust ###
5+
# Generated by Cargo
6+
# will have compiled files and executables
7+
/target
8+
9+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
10+
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
11+
# Cargo.lock
12+
13+
# These are backup files generated by rustfmt
14+
**/*.rs.bk
15+
16+
# End of https://www.gitignore.io/api/rust
17+
18+
# Used by macOS' file system to track custom attributes of containing folder
19+
.DS_Store
20+
21+
# Editors' specific files
22+
.idea/
23+
.vscode/
24+
*~

0 commit comments

Comments
 (0)