diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0d1c993978707..6bf427a8ef931 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -455,6 +455,31 @@ jobs: with: command: check licenses + rust_clippy: + needs: [determine_jobs] + if: needs.determine_jobs.outputs.rust == 'true' || + needs.determine_jobs.outputs.cargo_on_main == 'true' || + needs.determine_jobs.outputs.cargo_only == 'true' + name: Rust clippy + runs-on: + - "self-hosted" + - "linux" + - "x64" + - "metal" + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Turborepo Environment + uses: ./.github/actions/setup-turborepo-environment + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Run cargo clippy + run: | + cargo clippy --workspace --all-targets --features rustls-tls \ + -- --deny clippy::all --deny warnings --allow clippy::too_many_arguments + turborepo_rust_check: needs: [determine_jobs] # We test dependency changes only on main diff --git a/crates/turborepo-filewatch/src/hash_watcher.rs b/crates/turborepo-filewatch/src/hash_watcher.rs index 923dff51767eb..1a1c2f078eaf1 100644 --- a/crates/turborepo-filewatch/src/hash_watcher.rs +++ b/crates/turborepo-filewatch/src/hash_watcher.rs @@ -834,7 +834,7 @@ mod tests { .unwrap(); repo.branch("test-branch", ¤t_commit, false).unwrap(); repo.set_head("refs/heads/test-branch").unwrap(); - commit_all(&repo); + commit_all(repo); } #[tokio::test] diff --git a/crates/turborepo-vt100/src/entire_screen.rs b/crates/turborepo-vt100/src/entire_screen.rs index 3c9ba4d4556d0..75f8e92170817 100644 --- a/crates/turborepo-vt100/src/entire_screen.rs +++ b/crates/turborepo-vt100/src/entire_screen.rs @@ -19,6 +19,9 @@ impl<'a> EntireScreen<'a> { self.max_lines = max_lines; } + /// # Panics + /// + /// Will panic if `height` or `max_lines` do not fit in a u16. #[must_use] pub fn cell(&self, row: u16, col: u16) -> Option<&crate::Cell> { match self.max_lines { @@ -27,7 +30,9 @@ impl<'a> EntireScreen<'a> { // in this case we fuck ourselves :) HARD let (height, _) = self.size(); // Skip over these - let lines_to_cut = (height - max_lines) as u16; + let lines_to_cut: u16 = (height - max_lines) + .try_into() + .expect("height and max_lines should fit in a u16"); self.screen .grid() .all_row(lines_to_cut + row)