Skip to content

fix(macros): strip @return/@examples/@export from impl-block docs (#65)#195

Open
CGMossa wants to merge 1 commit intomainfrom
fix/issue-65-strip-method-tags
Open

fix(macros): strip @return/@examples/@export from impl-block docs (#65)#195
CGMossa wants to merge 1 commit intomainfrom
fix/issue-65-strip-method-tags

Conversation

@CGMossa
Copy link
Copy Markdown
Collaborator

@CGMossa CGMossa commented Apr 17, 2026

Closes #65.

Summary

Rename `strip_param_tags` to `strip_method_tags` and extend the filter to the full method-only set: `@param`, `@return`, `@returns`, `@examples`, `@export`. Tag-name matching is now exact (first whitespace-delimited token after `@`) so S4 `@exportClass` / `@exportMethod` / `@exportPattern` still pass through.

Each stripped tag emits the same deprecated-const compile warning pattern `@param` already did, so users get a diagnostic at build time pointing them at the offending impl block.

Test plan

  • `cargo test -p miniextendr-macros strip_method` — 3 new tests pass.
  • `cargo clippy --workspace --all-targets --locked -- -D warnings`
  • `cargo clippy --workspace --all-targets --locked --features -- -D warnings`
  • `just fmt`
  • `just rcmdinstall`
  • `just devtools-document` — regenerates `NAMESPACE` + `match_arg_tests.Rd` cleanly
  • `just vendor` — `rpkg/inst/vendor.tar.xz` refreshed
  • `just check`

Notes

No change to generated R wrappers for existing rpkg fixtures — no impl block uses the newly-stripped tags today. The wrapper / NAMESPACE / Rd diff in this PR is pre-existing drift (line numbers and one missing `match_arg_return_modes` entry) that `just devtools-document` catches up automatically.

`#[allow(clippy::boxed_local)]` on `match_arg_multi_mode_boxed` and the rustfmt drift in a few rpkg files are the same as #194 — those merge-conflict-free if #194 lands first (identical content).

Generated with Claude Code

…return/@examples/@export (#65)

`strip_param_tags` only removed `@param` from impl-block roxygen. Other
method-specific tags were left in place and leaked into the class-level
Rd file:

- `@return` / `@returns` — impl blocks have no return value
- `@examples` — belong on the demonstrated method
- `@export` — redundant; ClassDocBuilder handles class export

These now trigger the same deprecation warning as `@param` did. Tag-name
matching is now exact (first whitespace-delimited token after `@`), so
`@exportClass`, `@exportMethod`, and `@exportPattern` — which ARE valid
on S4 class-level docs — stay put.

Renamed the function and updated all three call sites in
`miniextendr_impl.rs`, `miniextendr_impl_trait.rs`, and
`miniextendr_impl_trait/vtable.rs`.

Added three unit tests in `roxygen/tests.rs` covering the strip list,
export-variant preservation, and prose pass-through.

Also carries the devtools-document / vendor regeneration. Some rustfmt
drift from the last `just fmt` run is included; the `#[allow(clippy::boxed_local)]`
on `match_arg_multi_mode_boxed` matches #194 to keep clippy_default
green.

Closes #65.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CGMossa CGMossa force-pushed the fix/issue-65-strip-method-tags branch from 18a03fa to dd98ab4 Compare April 17, 2026 10:57
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.

strip_param_tags should also strip other method-specific tags from impl blocks

1 participant