SeaQL/sea-orm

Refactor macro implmentions

オープン

#3,119 opened on 2026/07/07

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)Rust (718 件のフォーク)auto 404
good first issuehelp-wanted

Repository metrics

Stars
 (9,827 個のスター)
PR merge metrics
 (PR metrics pending)

説明

I did some refactoring in #3118, but the current macro implementation is still quite messy.

The refactoring mainly split the code that mixed parsing and expansion into separate steps.

Ideally, we should remove bae. We could consider using darling instead, or just write the parsing code manually. The current macro parser supports all possible combinations, and I worked around that by adding an extra normalization step, but it would be better to clean up the related code.

There are also many other things that can be simplified. I noticed a lot of recurring patterns like duplicated logic across branches, using parse(&str) instead of syn::parse_quote, using manually constructed strings and Idents instead of format_ident, and converting types such as Type or Ident into String for comparison and then converting them back, rather than comparing them directly.

I also noticed that some state can be derived rather than stored.

For contributors who want to help with this, I would suggest starting with small, focused changes, ideally by addressing one category of issues at a time. Furthermore, please don't open LLM-generated PRs.

コントリビューターガイド