Skip to content

Conversation

@pgherveou
Copy link
Contributor

@pgherveou pgherveou commented Jan 29, 2026

Summary

Adds guidance for AI assistants (like Claude Code) on preserving local code style when editing Rust code in this repository.

Guidelines Added

  • Do not add semicolons to existing return statements or break/continue if the original code omits them
  • Do not add braces to match arms or if-else expressions if the original code uses the braceless form
  • Do not change operator position (e.g., && or - at end of line vs start of next line)
  • Use cargo +nightly fmt for formatting, but avoid reformatting unrelated code in your changes
  • When in doubt, match the style of surrounding code

Motivation

This helps ensure AI-assisted code changes don't introduce unnecessary formatting differences that:

  • Make diffs harder to review
  • Cause merge conflicts
  • Deviate from the existing code style

Add guidance for AI assistants on preserving local code style when
editing Rust code, including:
- Not adding semicolons to existing return/break/continue statements
- Not adding braces to braceless match arms or if-else expressions
- Not changing operator positions (trailing vs leading)
- Using cargo fmt but avoiding reformatting unrelated code
@pgherveou pgherveou added the R0-no-crate-publish-required The change does not require any crates to be re-published. label Jan 29, 2026
@pgherveou pgherveou enabled auto-merge January 29, 2026 20:44
@pgherveou
Copy link
Contributor Author

closing will fix the rustoml instead

@pgherveou pgherveou closed this Jan 29, 2026
auto-merge was automatically disabled January 29, 2026 20:50

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R0-no-crate-publish-required The change does not require any crates to be re-published.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants