docs(guide/dev): remove generic and compiler-enforced sections#358
Merged
Conversation
Performance Regression Reportscommit: d77805c There are no regressions. |
KSXGitHub
pushed a commit
that referenced
this pull request
Mar 18, 2026
Remove `#[non_exhaustive]` from custom errors bullet and remove `#![deny(warnings)]` bullet, matching the removals in PR #358. https://claude.ai/code/session_012rU7VAeZADzFWewCEUMMyG
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the repository’s contribution guidelines by removing/condensing several style-policy sections in CONTRIBUTING.md.
Changes:
- Removes the explicit guideline to mark custom error enums as
#[non_exhaustive]. - Removes the “Documentation Comments”, “Feature Gating”, and “Warnings Policy” sections.
- Tweaks the “Pattern Matching” section wording/formatting.
Comments suppressed due to low confidence (1)
CONTRIBUTING.md:219
- The
Error Handlingsection no longer mentions marking custom error enums as#[non_exhaustive], but the example immediately below still uses#[non_exhaustive]. This is internally inconsistent for contributors; either restore the guideline bullet or remove/update the example so the guidance and sample code agree.
### Error Handling
- Define custom error enums with `#[derive(Debug, Display, Error)]` from `derive_more`.
- Minimize `unwrap()` in non-test code — use proper error propagation. `unwrap()` is acceptable in tests and for provably infallible operations (with a comment explaining why). When deliberately ignoring an error, use `.ok()` with a comment explaining why.
```rust
#[derive(Debug, Display, Error)]
#[non_exhaustive]
pub enum RuntimeError {
You can also share your feedback on Copilot code review. Take the survey.
Remove `#[non_exhaustive]` from custom errors bullet and remove `#![deny(warnings)]` bullet, matching the removals in PR #358. https://claude.ai/code/session_012rU7VAeZADzFWewCEUMMyG Co-authored-by: Claude <noreply@anthropic.com>
Remove Visibility, Struct Field Ordering, Macros, and `pub use ... as` bullet — these are either standard Rust knowledge, generic best practices, or not used in the codebase. https://claude.ai/code/session_01VE5W68ky3UobBMongN8Dfc Co-authored-by: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s contribution and agent instruction documentation by removing several previously documented style/policy guidelines (e.g., visibility rules, warnings policy, documentation comment rules) and simplifying the “custom errors” guidance.
Changes:
- Removed multiple sections from
CONTRIBUTING.md(visibility, documentation comments, feature gating, struct field ordering, macros, warnings policy). - Updated agent instruction docs (
CLAUDE.md,AGENTS.md,.github/copilot-instructions.md) to drop#[non_exhaustive]and#![deny(warnings)]mentions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| CONTRIBUTING.md | Removes several documented conventions and simplifies error-handling guidance. |
| CLAUDE.md | Updates the “Quick Reference” rules for agents (notably custom errors and warnings policy). |
| AGENTS.md | Same “Quick Reference” updates as CLAUDE.md. |
| .github/copilot-instructions.md | Same “Quick Reference” updates as CLAUDE.md, for Copilot instructions. |
Comments suppressed due to low confidence (2)
CONTRIBUTING.md:207
- The
Error Handlingsection no longer mentions#[non_exhaustive], but the example immediately below still includes#[non_exhaustive](and the codebase uses it widely). This is internally inconsistent—either re-add the guideline, or remove/update the example (and any related guidance) so the section is self-consistent.
### Error Handling
- Define custom error enums with `#[derive(Debug, Display, Error)]` from `derive_more`.
- Minimize `unwrap()` in non-test code — use proper error propagation. `unwrap()` is acceptable in tests and for provably infallible operations (with a comment explaining why). When deliberately ignoring an error, use `.ok()` with a comment explaining why.
```rust
#[derive(Debug, Display, Error)]
#[non_exhaustive]
pub enum RuntimeError {
CONTRIBUTING.md:231
- This document removed the
Warnings Policynote, but the crate still has#. Contributors will still hit warning-as-error failures; please reintroduce a brief note here (or point to where this policy is documented) so CONTRIBUTING matches actual build behavior.
## Setup
Install the required Rust toolchain and components before running any checks:
```sh
rustup toolchain install "$(< rust-toolchain)"
rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy
</details>
---
You can also share your feedback on Copilot code review. [Take the survey](https://www.surveymonkey.com/r/XP6L3XJ).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keep the contributing guide focused on conventions unique to this project rather than restating standard Rust practices or compiler-enforced rules.
Removed from CONTRIBUTING.md:
#[non_exhaustive]requirement from error enum guidelines#![deny(warnings)]is self-enforcing)pub/pub(crate)is basic Rust knowledge)pub use ... as ...exampleUpdated CLAUDE.md, AGENTS.md, and copilot-instructions.md to match:
#[non_exhaustive]from custom errors line#![deny(warnings)]line