Skip to content

Commit e7e78f2

Browse files
authored
Run Cargo clippy and fmt in CI (#392)
* Run Cargo clippy and fmt in CI Since we should always be running these in CI for all projects that use Rust. The job was copied from that run here: https://github.com/heroku/heroku-java-metrics-agent/blob/86dd6bf68d3cafdecbc0b281f2a4f54a00c41371/.github/workflows/ci.yml#L82-L98 GUS-W-18062768. * Fix Clippy errors
1 parent a96445b commit e7e78f2

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

.github/workflows/ci.yml

+18
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ jobs:
4747
working-directory: "integration-test"
4848
run: "cargo test --locked"
4949

50+
rust-lint:
51+
runs-on: ubuntu-24.04
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
- name: Update Rust toolchain
56+
run: rustup update
57+
- name: Rust Cache
58+
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
59+
with:
60+
workspaces: "./integration-test"
61+
- name: Clippy
62+
run: cargo clippy --all-targets --all-features --locked -- --deny warnings
63+
working-directory: integration-test
64+
- name: rustfmt
65+
run: cargo fmt -- --check
66+
working-directory: integration-test
67+
5068
maven:
5169
name: "Unit Tests (Java ${{ matrix.java-version }})"
5270
runs-on: ubuntu-24.04

integration-test/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ unreachable_pub = "warn"
88
unused_crate_dependencies = "warn"
99

1010
[lints.clippy]
11-
pedantic = "warn"
11+
pedantic = { level = "warn", priority = -1 }
12+
missing_panics_doc = "allow"
1213

1314
[dependencies]
1415
exponential-backoff = "2"

integration-test/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub fn heroku_jvm_application_deployer_jar_path() -> PathBuf {
4343
let dir_entry = dir_entry.unwrap();
4444
let file_name = dir_entry.file_name().to_string_lossy().into_owned();
4545

46+
#[allow(clippy::case_sensitive_file_extension_comparisons)]
4647
if file_name.starts_with("heroku-jvm-application-deployer") && file_name.ends_with(".jar") {
4748
return dir_entry.path();
4849
}
@@ -171,7 +172,6 @@ where
171172
result @ Err(_) => match backoff_durations.next() {
172173
Some(Some(backoff_duration)) => {
173174
std::thread::sleep(backoff_duration);
174-
continue;
175175
}
176176
_ => return result,
177177
},

0 commit comments

Comments
 (0)