Skip to content

Comments

Added Rust pre-commit hooks#868

Open
quan319 wants to merge 1 commit intoapache:mainfrom
quan319:main
Open

Added Rust pre-commit hooks#868
quan319 wants to merge 1 commit intoapache:mainfrom
quan319:main

Conversation

@quan319
Copy link

@quan319 quan319 commented Feb 17, 2026

Reason for this PR

This PR addresses the request to add missing Rust pre-commit hooks to the repository. The project already includes pre-commit checks for other languages, but Rust tooling was not yet covered. Adding these hooks helps keep Rust code formatted consistently and improves development workflow.

This work is related to issue #753.

What changes are included in this PR?

Added a Rust cargo fmt pre-commit hook for consistent formatting
Added a Rust cargo clippy hook which I configured as manual to surface lint warnings without blocking commits

Are these changes tested?

Yes the changes were tested. The cargo fmt hook was run locally to verify formatting behavior.
The cargo clippy hook was verified to run correctly and is configured as a manual hook due to platform-specific build dependencies.

Are there any user-facing changes?

No. These changes only affect development tooling and do not impact end users or public APIs.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Rust-focused pre-commit hooks to the repository’s existing pre-commit setup, aligning Rust development workflow with the formatting/linting checks already present for other languages.

Changes:

  • Added a local cargo fmt pre-commit hook to enforce consistent Rust formatting.
  • Added a local cargo clippy hook configured to run only in the manual stage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

name: Rust cargo fmt
entry: bash -c 'cd rust && cargo fmt --all'
language: system
files: ^rust/.*\.(rs|toml|lock)$
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cargo-fmt hook is configured to run on .toml and .lock changes, but cargo fmt only formats Rust source files. Consider narrowing the files regex to ^rust/.*\.rs$ (or switching to types: [rust]) to avoid unnecessary hook runs on non-Rust files.

Suggested change
files: ^rust/.*\.(rs|toml|lock)$
files: ^rust/.*\.rs$

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant