Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document use of rustfmt and dprint for formatting #4138

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,35 @@ of the print version. The snapshot files reflect what has been sent or not, so
they only get updated when edits are sent to No Starch. **Do not submit pull
requests changing files in the `nostarch` directory, they will be closed.**

We use [`rustfmt`][rustfmt] to apply standard formatting to Rust code in the
repo and [`dprint`][dprint] to apply standing formatting to the Markdown source
and the non-Rust code in the project.

[rustfmt]: https://github.com/rust-lang/rustfmt
[dprint]: https://dprint.dev

You will normally have `rustfmt` installed if you have a Rust toolchain
installed; if for some reason you do not have a copy of `rustfmt`, you can add
it by running the following command:

```sh
rustup component add rustfmt
```

To install `dprint`, you can run the following command:

```sh
cargo install dprint
```

Or follow the [instructions][install-dprint] on the `dprint` website.

[install-dprint]: https://dprint.dev/install/

To format Rust code, you can run `rustfmt <path to file>`, and to format other
files, you can pass `dprint <path to file>`. Many text editors also have native
support or extensions for both `rustfmt` and `dprint`.

## Checking for Fixes

The book rides the Rust release trains. Therefore, if you see a problem on
Expand Down
Loading