Merge branch 'main' into feature/modular-config
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
commit
119b58fd79
2 changed files with 25 additions and 14 deletions
16
.drone.yml
16
.drone.yml
|
@ -9,16 +9,16 @@ steps:
|
||||||
- name: code style
|
- name: code style
|
||||||
image: rust:1.47
|
image: rust:1.47
|
||||||
commands:
|
commands:
|
||||||
- rustup component add rustfmt
|
- rustup toolchain install nightly-x86_64-unknown-linux-gnu
|
||||||
- cargo fmt --all -- --check
|
- rustup component add rustfmt --toolchain nightly
|
||||||
|
- cargo +nightly fmt --all -- --check
|
||||||
# - name: code quality
|
# - name: code quality
|
||||||
# image: rust:1.47
|
# image: rust:1.47
|
||||||
# commands:
|
# commands:
|
||||||
# - cargo clippy -- --deny warnings
|
# - cargo clippy -- --deny warnings
|
||||||
# - name: test
|
- name: test
|
||||||
# image: rust:1.47
|
image: rust:1.47
|
||||||
# commands:
|
commands:
|
||||||
# - cargo build --verbose --all
|
- cargo build --verbose --all
|
||||||
# - cargo test --verbose --all
|
- cargo test --verbose --all
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,13 @@
|
||||||
|
|
||||||
#### Installing rustfmt
|
#### Installing rustfmt
|
||||||
|
|
||||||
You can run `rustfmt` with Rust 1.24 and above.
|
You must install a very recent version of `rustfmt` through rust nightly
|
||||||
|
|
||||||
To install:
|
To install:
|
||||||
|
|
||||||
```
|
```
|
||||||
rustup component add rustfmt
|
rustup toolchain install nightly-x86_64-unknown-linux-gnu
|
||||||
|
rustup component add rustfmt --toolchain nightly
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Usage
|
#### Usage
|
||||||
|
@ -21,14 +22,24 @@ rustup component add rustfmt
|
||||||
To run on Diplonat, launch the following in the root directory:
|
To run on Diplonat, launch the following in the root directory:
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo fmt --all
|
cargo +nightly fmt
|
||||||
```
|
```
|
||||||
|
|
||||||
This will format the whole repository using the settigs defined in [`.rustfmt.toml`](./.rustfmt.toml): soft tabs of 2 spaces.
|
This will format the whole repository using the settigs defined in [`.rustfmt.toml`](./.rustfmt.toml).
|
||||||
|
|
||||||
#### Auto-format code
|
#### Auto-format code
|
||||||
|
|
||||||
You can automate formatting in a number of ways:
|
You can automate formatting in a number of ways:
|
||||||
|
|
||||||
* [Setup your IDE to use `rustfmt`](https://github.com/rust-lang/rustfmt#running-rustfmt-from-your-editor).
|
[Setup your IDE to use `rustfmt`](https://github.com/rust-lang/rustfmt#running-rustfmt-from-your-editor).
|
||||||
* Setup a git hook to run `rustfmt` before each commit.
|
|
||||||
|
Setup a git hook to run `rustfmt` before each commit:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat <<EOF > .git/hooks/pre-commit
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cargo +nightly fmt
|
||||||
|
EOF
|
||||||
|
chmod +x .git/hooks/pre-commit
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue