deprecated variants trigger lint rules
- Dominant language
- Rust
- Stars
- 853
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
Marking a variant of an `enum` as deprecated seems to cause `binrw` macros to create code that triggers lint rules.
It makes sense to document these `enum` variants as deprecated so that:
- Any data encountered in the future can be reported as using deprecated features/whatnot and, depending on whether the deprecation is completed, the code can still honor the deprecated variant or refuse in a way that external code and/or users can cogently respond to.
- Any code in the future can treat these values as reserved. This prevents confusion between future added features and old deprecated features.
Marking the whole binrw-wrapped `enum` with `#[expect(deprecated)]` does not silence the lint.
Ideal solution (may not be feasible):
- binrw would parse the `#[deprecated(..)]` attribute for `enum` variants and apply `#[expect(deprecated)]` anywhere the variant is read/written.
Other:
- A catch-all binrw item-level attribute which applies allow/expect/deny linting attributes to all the binrw code for the item. e.g.
```#[brw(allow(deprecated), allow(non_snake_case), ...)]```
Unfortunately my Rust proc macro skills aren't up to verifying that this is triggering the lint rules and modifying binrw to guage how feasible any of these "solution" ideas might be.
Contributor guide
Research direction
No files or tests are named. Start by reproducing a binrw-wrapped enum with a deprecated variant and inspect the macro-generated code to find where the lint is triggered; done means the generated code handles the deprecated variant without emitting the unwanted lint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100