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 - master@World/podcasts
- tags - tags
# Configure and run rustfmt on nightly # Configure and run rustfmt
# Exits and builds fails if on bad format # Exits and builds fails if on bad format
rustfmt: rustfmt:
image: "registry.gitlab.com/alatiera/rustfmt-oci-image/rustfmt:nightly" image: "rust:slim"
stage: lint stage: "lint"
script: script:
- rustc -Vv && cargo -Vv - rustup component add rustfmt
- cargo fmt --version - rustc -Vv && cargo -Vv
- cargo fmt --all -- --check - cargo fmt --version
- 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. 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 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`. Don't forget to `git add` again after `cargo fmt`.
``` ```
#!/bin/sh #!/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 ## Running the test suite

View File

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

View File

@ -127,14 +127,13 @@ mod tests {
fn test_extract() -> Result<(), Error> { fn test_extract() -> Result<(), Error> {
let int_title = String::from("Intercepted with Jeremy Scahill"); let int_title = String::from("Intercepted with Jeremy Scahill");
let int_url = String::from("https://feeds.feedburner.com/InterceptedWithJeremyScahill"); let int_url = String::from("https://feeds.feedburner.com/InterceptedWithJeremyScahill");
let int_desc = let int_desc = String::from(
String::from( "The people behind The Intercepts fearless reporting and incisive \
"The people behind The Intercepts fearless reporting and incisive \ commentaryJeremy Scahill, Glenn Greenwald, Betsy Reed and othersdiscuss the \
commentaryJeremy Scahill, Glenn Greenwald, Betsy Reed and othersdiscuss the \ crucial issues of our time: national security, civil liberties, foreign policy, \
crucial issues of our time: national security, civil liberties, foreign policy, \ and criminal justice. Plus interviews with artists, thinkers, and newsmakers \
and criminal justice. Plus interviews with artists, thinkers, and newsmakers \ who challenge our preconceptions about the world we live in.",
who challenge our preconceptions about the world we live in.", );
);
let dec_title = String::from("Deconstructed with Mehdi Hasan"); let dec_title = String::from("Deconstructed with Mehdi Hasan");
let dec_url = String::from("https://rss.prod.firstlook.media/deconstructed/podcast.rss"); let dec_url = String::from("https://rss.prod.firstlook.media/deconstructed/podcast.rss");

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" edition = "2018"