From 1fc4842e4cf6ac0d4ff6a74e2f806d9a8fbd3e6c Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Thu, 19 Nov 2020 14:47:04 -0800 Subject: [PATCH] Fix CI (#727) - Replace `::add-path::` CI command with environment files - Placate Clippy - Consolidate cache actions --- .github/workflows/build.yaml | 29 +++++++---------------------- src/lib.rs | 4 +++- src/recipe.rs | 2 +- src/shebang.rs | 2 +- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6d27c15..68aee53 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,12 +10,6 @@ on: branches: - master -env: - # Increment to invalidate github actions caches if they become corrupt. - # Errors of the form "can't find crate for `snafu_derive` which `snafu` depends on" - # can usually be fixed by incrementing this value. - CACHE_KEY_PREFIX: 4 - jobs: all: name: All @@ -48,25 +42,16 @@ jobs: if: matrix.os == 'macos-latest' run: | brew install gnu-tar - echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" + echo /usr/local/opt/gnu-tar/libexec/gnubin > $GITHUB_PATH - - name: Cache cargo registry + - name: Cache Cargo uses: actions/cache@v1 with: - path: ~/.cargo/registry - key: ${{ env.CACHE_KEY_PREFIX }}-${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo index - uses: actions/cache@v1 - with: - path: ~/.cargo/git - key: ${{ env.CACHE_KEY_PREFIX }}-${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: ${{ env.CACHE_KEY_PREFIX }}-${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install Main Toolchain uses: actions-rs/toolchain@v1 diff --git a/src/lib.rs b/src/lib.rs index 4d1d422..171066c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,6 @@ #![deny(clippy::all, clippy::pedantic, clippy::restriction)] #![allow( clippy::blanket_clippy_restriction_lints, - clippy::option_if_let_else, clippy::comparison_chain, clippy::else_if_without_else, clippy::enum_glob_use, @@ -19,7 +18,9 @@ clippy::missing_inline_in_public_items, clippy::needless_pass_by_value, clippy::non_ascii_literal, + clippy::option_if_let_else, clippy::panic, + clippy::panic_in_result_fn, clippy::pattern_type_mismatch, clippy::print_stdout, clippy::shadow_unrelated, @@ -27,6 +28,7 @@ clippy::struct_excessive_bools, clippy::too_many_lines, clippy::unreachable, + clippy::unwrap_in_result, clippy::unwrap_used, clippy::use_debug, clippy::wildcard_enum_match_arm, diff --git a/src/recipe.rs b/src/recipe.rs index d854dd5..e2d2601 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -234,7 +234,7 @@ impl<'src, D> Recipe<'src, D> { command = &command[1..]; } - if command == "" { + if command.is_empty() { continue; } diff --git a/src/shebang.rs b/src/shebang.rs index d74ac34..1fe7a95 100644 --- a/src/shebang.rs +++ b/src/shebang.rs @@ -19,7 +19,7 @@ impl<'line> Shebang<'line> { let interpreter = pieces.next().unwrap_or(""); let argument = pieces.next(); - if interpreter == "" { + if interpreter.is_empty() { return None; }