File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 1
- # rustfmt
2
- Check formatting of Rust code with rustfmt
1
+ # Run ` rustfmt `
2
+
3
+ Run ` cargo fmt --all ` and report all formatting differences in a nice overview.
4
+ It works best in combination with [ ` actions-rust-lang/setup-rust-toolchain ` ] for [ problem matcher] highlighting.
5
+
6
+ Execution Summary:
7
+
8
+ ![ The action reports any formatting issues found by rustfmt.] ( ./imgs/rustfmt-results.png )
9
+
10
+ Problem Matcher:
11
+
12
+ ![ Annotation highlighting formatting differences.] ( ./imgs/rustfmt-problem-matcher.png )
13
+
14
+ ## Example workflow
15
+
16
+ ``` yaml
17
+ name : " Test Suite"
18
+ on :
19
+ push :
20
+ pull_request :
21
+
22
+ jobs :
23
+ formatting :
24
+ name : cargo fmt
25
+ runs-on : ubuntu-latest
26
+ steps :
27
+ - uses : actions/checkout@v3
28
+ # Ensure rustfmt is installed and setup problem matcher
29
+ - uses : actions-rust-lang/setup-rust-toolchain@v1
30
+ with :
31
+ components : rustfmt
32
+ - name : Rustfmt Check
33
+ uses : actions-rust-lang/rustfmt@v1
34
+ ` ` `
35
+
36
+ [` actions-rust-lang/setup-rust-toolchain`]: https://github.com/actions-rust-lang/setup-rust-toolchain
37
+ [problem matcher] : https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md
You can’t perform that action at this time.
0 commit comments