From 7e6a0ab7586f66ff421ddb46fa381b59c34742ea Mon Sep 17 00:00:00 2001 From: Emilio Cobos Álvarez Date: Tue, 1 Nov 2016 15:07:28 +0100 Subject: Add a section about automatic code formatting in CONTRIBUTING.md --- CONTRIBUTING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 001ad0e2..c7e5198c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,7 @@ yourself. * [Running All Tests](#tests-all) * [Running a Single, Specific Test](#tests-one) * [Authoring New Tests](#tests-new) +* [Automatic Code Formatting](#formatting) * [Debug Logging](#logs) ## Code of Conduct @@ -95,6 +96,27 @@ specify the required features at the top of the test header in a similar manner: // bingden-features: llvm_stable ``` +## Automatic code formatting + +There's a `rustfmt.toml` file in the repo. Ideally changes should be consistent +with the style, though that's not enforced right now. + +[`rustfmt`](https://github.com/rust-lang-nursery/rustfmt) can catch and fix +automatically all the coding style issues it finds. In order to use it it +suffices to do: + +``` +$ cargo fmt +``` + +For it to work, you need to have `rustfmt` installed. To do so: + +``` +$ cargo install rustfmt +``` + +And ensure `~/.cargo/bin` is on your path. + ## Debug Logging To help debug what `bindgen` is doing, you can define the environment variable -- cgit v1.2.3