Skip to content

Commit 9d16ea8

Browse files
committed
Update readme
1 parent f25bee4 commit 9d16ea8

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
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

imgs/rustfmt-problem-matcher.png

18.1 KB
Loading

imgs/rustfmt-results.png

62.3 KB
Loading

0 commit comments

Comments
 (0)