Skip to content

fix: doc comment on Role variant crashes macro#33

Merged
mooori merged 1 commit into
near:masterfrom
mooori:ev-comment
Oct 22, 2022
Merged

fix: doc comment on Role variant crashes macro#33
mooori merged 1 commit into
near:masterfrom
mooori:ev-comment

Conversation

@mooori
Copy link
Copy Markdown
Contributor

@mooori mooori commented Oct 21, 2022

Closes #28

} = input;

let variants = variants.into_iter().collect::<Vec<_>>();
let variant_idents = variants.into_iter().map(|v| v.ident).collect::<Vec<_>>();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was a bug to not do map(|v| v.ident). The test contract used only plain variants like LevelA without comments, data or custom discriminants, which prevented the bug from surfacing.

Comment on lines +7 to +15
/// Roles are represented by enum variants.
#[derive(AccessControlRole, Deserialize, Serialize, Copy, Clone)]
#[serde(crate = "near_sdk::serde")]
pub enum Role {
/// Represents LevelA.
LevelA,
/// Represents LevelB.
LevelB,
/// Represents LevelC.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding not-so-meaningful comments to show it's now working and to avoid regressions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just a note, we can add these comments in an enum in some of the examples to test the regression.

@mooori mooori marked this pull request as ready for review October 21, 2022 18:40
@mooori mooori requested a review from mfornet October 21, 2022 18:40
Copy link
Copy Markdown

@sept-en sept-en left a comment

Choose a reason for hiding this comment

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

LGTM!

@mooori mooori merged commit daf706e into near:master Oct 22, 2022
@mooori mooori deleted the ev-comment branch October 22, 2022 15:50
This was referenced Mar 27, 2026
@github-actions github-actions Bot mentioned this pull request Apr 7, 2026
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.

Comments on AccessControlRole enum variants not working

3 participants