Skip to content

refactor(type): drop redundant lombok accessor attributes - #38

Merged
eastspire merged 3 commits into
masterfrom
refactor/drop-redundant-accessor-pub-2026-09-27
Sep 27, 2026
Merged

eastspire merged 3 commits into
masterfrom
refactor/drop-redundant-accessor-pub-2026-09-27

Conversation

@eastspire

@eastspire eastspire commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Clean up violations of two rust-standards lombok accessor rules:

  • §17.14.1 (check 23) — drop a redundant explicit pub. The Default of
    lombok_macros::Visibility is already Public
    (lombok-macros/src/visibility/enum.rs), so omitting the visibility
    generates a pub accessor and spelling out pub is pure noise.
  • §17.14.2 (check 24) — drop bare #[get] / #[get_mut] / #[set].
    #[derive(Data)] is Getter + GetterMut + Setter in one, so the field
    already has its accessor and an argument-less attribute just restates the
    default.

Why both rules must land in one PR

They are two levels of the same construct, not two independent rules:

#[get(pub)]   // violates check 23
#[get]        // what check 23's table called "the fix" — violates check 24
              // the only legal end state: the whole line is gone

Applying check 23 alone turns 12 #[get(pub)] into 12 bare #[get], which
creates exactly the violations check 24 forbids. So this PR walks straight to
the end state: delete the line where the attribute is redundant, keep it only
where it carries information.

This is also why rust-standards/references/17-lombok-derives.md §17.14.1 was
corrected in the same series — its table listed #[get] as check 23's answer,
which was wrong.

Changes

Three commits:

Commit Content
ef3f8ba Drop redundant explicit pub
cffb620 chore: bump version to 21.9.0
361a2a8 Drop bare accessor attributes — 23 across 3 files

Files touched:

  • core/src/route/struct.rs — 4
  • type/src/request/struct.rs — 7
  • type/src/task/struct.rs — 12

Verification

  • cargo check --workspace --all-targets passes
  • cargo clippy --workspace --all-targets — 0 warnings
  • verify_no_redundant_accessor_attr.py → 378 files checked, 0 violations
  • audit check 23 and check 24 both PASS
  • No bare attribute and no #[…(pub)] remains anywhere in the tree

Notes

Deliberately left alone:

  • #[get(pub(crate))] / #[set(pub(crate))] / #[get_mut(pub(crate))] —
    visibility narrowing required by §17.14
  • #[get(type(copy))], #[set(Into)], #[get(skip)] and friends — they carry
    information the derive cannot infer
  • #[new(...)] / #[with(...)] — New and With are independent derives
    that Data does not imply, so their attributes are always meaningful

The repository still has pre-existing violations in unrelated checks (§5.1
explicit type annotations, §2.1 doc comments, §1.3c hardcoded strings,
§13.7 features order) that predate this PR. This PR does not claim a clean
whole-repo audit.

lombok_macros::Visibility defaults to Public, so an accessor
attribute that omits visibility already generates a pub accessor.
All four fields on Task are themselves pub, so the explicit argument
was a no-op in every case.

  #[get(pub)]     -> #[get]
  #[get_mut(pub)] -> #[get_mut]
  #[set(pub)]     -> #[set]

Visibility narrowing is untouched: pub(crate) forms are unaffected,
since that is the deliberate restriction path.
Every accessor-providing derive already emits its accessors for
each field, so an argument-less attribute only restates that:

  #[derive(Data)]  ->  inner_lombok_data(input, true, true, true)
                      (lombok-macros/src/generate/fn.rs)

Drop 23 bare attributes across 3 files. Attributes carrying
configuration (type(copy), skip, Into, ...) are untouched, and so
are those whose accessor the derive set does not provide — e.g.
#[set] on a #[derive(Getter)] struct.

Verified by compilation: 491 workspace tests pass, clippy clean,
fmt clean.
@eastspire eastspire changed the title refactor(type): drop redundant explicit pub from lombok accessor attrs + bump to 21.9.0 refactor(type): drop redundant lombok accessor attributes Sep 27, 2026
eastspire added a commit to eastspire/.agents that referenced this pull request Sep 27, 2026
The rule was already written in §1, §2 and §7 — "all English", and the
author is the personal account from ~/.gitconfig. Two PRs were then
opened with Chinese titles and Chinese bodies while the rule sat in the
file. Prose has no enforcement point, so this adds one.

verify_english_only.py has three modes:

  text   <file>...                     CJK / fullwidth scan
  commit <msgfile> [--repo R]          + Conventional Commits + author
  pr     <title> --body <file>         + the 4-section body template

Detection covers CJK Unified + Ext A + Ext B, compatibility ideographs,
Kangxi and CJK radicals, kana, hangul, bopomofo, yi, and fullwidth
forms, reported as line/column/character so a violation is actionable
rather than a bare "non-English". Latin-1 and accented English
(Kierkegaard, e.g., 50% off) pass clean.

commit mode also checks subject shape, the 72-char limit, trailing
periods, imperative mood and 72-col body wrapping, and resolves the
author through `git config user.email` so a stale per-repo override is
caught before it reaches history. pr mode reuses the same subject check
on the title and requires all four §2.2 sections, so one call covers
both the language rule and the shape rule.

Two PRs rewritten in English to comply: euv-dev/euv#286 and
hyperlane-dev/hyperlane#38. Both already carried the correct author
(eastspire <root@ltpp.vip>, attributed to the eastspire GitHub
account) and Conventional Commits subjects; only the prose was wrong.
The verifier caught both new titles at 76 chars on the first attempt.

Pitfalls 17-19 record the three ways this work went wrong on the way:
a prose rule that cannot fail, a missing execute bit reported as
"Permission denied", and a fixture loop reading `$?` from `basename`
instead of the verifier.
@eastspire
eastspire merged commit 5366a42 into master Sep 27, 2026
8 checks passed
@eastspire
eastspire deleted the refactor/drop-redundant-accessor-pub-2026-09-27 branch September 27, 2026 23:32
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