Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sol-macro): allow missing docs for event fields #619

Merged
merged 1 commit into from
May 6, 2024

Conversation

alexfertel
Copy link
Contributor

See #588 (comment)

Motivation

We want this sol! invocation to not generate a missing_docs warning:

sol! {
    /// Emitted when `value` tokens are moved from one account (`from`) to
    /// another (`to`).
    ///
    /// Note that `value` may be zero.
    event Transfer(address indexed from, address indexed to, uint256 value);
    /// Emitted when the allowance of a `spender` for an `owner` is set by a
    /// call to `approve`. `value` is the new allowance.
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

Solution

We add an #[allow(missing_docs)] annotation to the generated event struct fields. The alternative would be supporting:

sol! {
    /// ...
    event Approval(
        /// ...
        address indexed owner,
        /// ...
        address indexed spender,
        /// ...
        uint256 value
    );
}

Which is less readable and redundant.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

I don't think the above apply, but lmk if that is not the case.

@alexfertel alexfertel requested a review from DaniPopes as a code owner May 5, 2024 14:13
Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@onbjerg onbjerg added the enhancement New feature or request label May 5, 2024
@gakonst
Copy link
Member

gakonst commented May 6, 2024

OK with this as temp fix, and we can do the full solution in follow-up

@gakonst gakonst merged commit 30b29ab into alloy-rs:main May 6, 2024
30 checks passed
@alexfertel alexfertel deleted the ignore-missing-docs-event-fields branch May 6, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants