From 7670ffe10162acbece6ec14066b549709ae6eb89 Mon Sep 17 00:00:00 2001 From: Will Stott Date: Mon, 20 Apr 2020 08:56:02 +0100 Subject: [PATCH] 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 --- .travis.yml | 20 +++++++++++++++++--- CONTRIBUTING.md | 4 ++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index e268d62..1412ca4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 12a14b1..2d58b9f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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