diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1b06adb..b8a1ccb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 - script: - - rustc -Vv && cargo -Vv - - cargo fmt --version - - cargo fmt --all -- --check + image: "rust:slim" + stage: "lint" + script: + - rustup component add rustfmt + - rustc -Vv && cargo -Vv + - cargo fmt --version + - cargo fmt --all -- --color=always --check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 296086d..28e4491 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/podcasts-data/src/models/new_show.rs b/podcasts-data/src/models/new_show.rs index d28510e..cb83e85 100644 --- a/podcasts-data/src/models/new_show.rs +++ b/podcasts-data/src/models/new_show.rs @@ -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() }; diff --git a/podcasts-data/src/opml.rs b/podcasts-data/src/opml.rs index 8bd58d0..2edccc9 100644 --- a/podcasts-data/src/opml.rs +++ b/podcasts-data/src/opml.rs @@ -127,14 +127,13 @@ 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( - "The people behind The Intercept’s fearless reporting and incisive \ - commentary—Jeremy Scahill, Glenn Greenwald, Betsy Reed and others—discuss the \ - crucial issues of our time: national security, civil liberties, foreign policy, \ - and criminal justice. Plus interviews with artists, thinkers, and newsmakers \ - who challenge our preconceptions about the world we live in.", - ); + let int_desc = String::from( + "The people behind The Intercept’s fearless reporting and incisive \ + commentary—Jeremy Scahill, Glenn Greenwald, Betsy Reed and others—discuss the \ + crucial issues of our time: national security, civil liberties, foreign policy, \ + and criminal justice. Plus interviews with artists, thinkers, and newsmakers \ + who challenge our preconceptions about the world we live in.", + ); let dec_title = String::from("Deconstructed with Mehdi Hasan"); let dec_url = String::from("https://rss.prod.firstlook.media/deconstructed/podcast.rss"); diff --git a/rustfmt.toml b/rustfmt.toml index ed9dd92..32a9786 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -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"