Browse Source

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
Will Stott 4 years ago
parent
commit
7670ffe101
2 changed files with 19 additions and 5 deletions
  1. 17 3
      .travis.yml
  2. 2 2
      CONTRIBUTING.md

+ 17 - 3
.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"

+ 2 - 2
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