Use rustfmt from the stable rustup channel

This commit is contained in:
Jordan Petridis 2019-01-05 14:56:38 +02:00
parent ea9ddc58c0
commit 2257688c65
No known key found for this signature in database
GPG Key ID: E8523968931763BE
5 changed files with 23 additions and 25 deletions

View File

@ -85,12 +85,13 @@ stop_review:
- master@World/podcasts
- tags
# Configure and run rustfmt on nightly
# Configure and run rustfmt
# Exits and builds fails if on bad format
rustfmt:
image: "registry.gitlab.com/alatiera/rustfmt-oci-image/rustfmt:nightly"
stage: lint
image: "rust:slim"
stage: "lint"
script:
- rustup component add rustfmt
- rustc -Vv && cargo -Vv
- cargo fmt --version
- cargo fmt --all -- --check
- cargo fmt --all -- --color=always --check

View File

@ -26,9 +26,12 @@ makes things easier for the maintainers.
We use [rustfmt](https://github.com/rust-lang-nursery/rustfmt) for code formatting and we enforce it on the gitlab-CI server.
Quick setup
***Installing rustfmt*** As of 2019/Jan, our continuous integration
pipeline assumes the version of rustfmt that is distributed through the
stable channel of [rustup](rustup.rs). You can install it with
```
cargo install rustfmt-nightly
rustup component add rustfmt
cargo fmt --all
```
@ -36,7 +39,7 @@ It is recommended to add a pre-commit hook to run cargo test and `cargo fmt`.
Don't forget to `git add` again after `cargo fmt`.
```
#!/bin/sh
cargo test -- --test-threads=1 && cargo fmt --all -- --write-mode=diff
cargo test -- --test-threads=1 && cargo fmt --all -- --check
```
## Running the test suite

View File

@ -242,7 +242,8 @@ mod tests {
.image_uri(Some(String::from(
"https://imagecdn.acast.com/image?h=1500&w=1500&source=http%3A%2F%2Fi1.sndcdn.\
com%2Favatars-000317856075-a2coqz-original.jpg",
))).source_id(42)
)))
.source_id(42)
.build()
.unwrap()
};

View File

@ -127,8 +127,7 @@ mod tests {
fn test_extract() -> Result<(), Error> {
let int_title = String::from("Intercepted with Jeremy Scahill");
let int_url = String::from("https://feeds.feedburner.com/InterceptedWithJeremyScahill");
let int_desc =
String::from(
let int_desc = String::from(
"The people behind The Intercepts fearless reporting and incisive \
commentaryJeremy Scahill, Glenn Greenwald, Betsy Reed and othersdiscuss the \
crucial issues of our time: national security, civil liberties, foreign policy, \

View File

@ -1,7 +1 @@
comment_width = 100
wrap_comments = true
newline_style = "Unix"
format_strings = true
normalize_comments = true
use_field_init_shorthand = true
edition = "2018"