Only format with stable rustfmt (#465)

* Always format with stable rustfmt

* Recommend always using stable rustfmt

* Tweak travis ci to allow nightly failures and only run fmt checks on stable
This commit is contained in:
Will Stott 2020-04-20 08:56:02 +01:00 committed by GitHub
parent d77376a800
commit 7670ffe101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 5 deletions

View file

@ -14,7 +14,23 @@ cache:
# But don't cache the cargo registry
before_cache:
- rm -rf /home/travis/.cargo/registry
matrix:
# Performance tweak
fast_finish: true
# Ignore failures in nightly, not ideal, but necessary
allow_failures:
- rust: nightly
# Only run the formatting check for stable
include:
- name: 'Rust: format check'
rust: stable
install:
- rustup component add rustfmt
script:
- cargo fmt --verbose --all -- --check
addons:
apt:
packages:
@ -26,14 +42,12 @@ addons:
- libsdl2-dev
before_script:
- rustup component add rustfmt
- mkdir -p ~/.cargo
- echo '[target.armv7-unknown-linux-gnueabihf]' > ~/.cargo/config
- echo 'linker = "arm-linux-gnueabihf-gcc"' >> ~/.cargo/config
- rustup target add armv7-unknown-linux-gnueabihf
script:
- cargo fmt --all -- --check
- cargo build --locked --no-default-features
- cargo build --locked --examples
- cargo build --locked --no-default-features --features "with-tremor"

View file

@ -31,10 +31,10 @@ Make any changes that you are going to make to the code, but do not commit yet.
Make sure that the code is correctly formatted by running:
```bash
cargo fmt --all
cargo +stable fmt --all
```
This command runs the previously installed ```rustfmt```, a code formatting tool that will automatically correct any formatting that you have used that does not conform with the librespot code style. Once that command has run, you will need to rebuild the project:
This command runs the previously installed stable version of ```rustfmt```, a code formatting tool that will automatically correct any formatting that you have used that does not conform with the librespot code style. Once that command has run, you will need to rebuild the project:
```bash
cargo build