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

Make as Variant optional for #[messages(...)] attribtue #168

Closed
hashedone opened this issue Jun 9, 2023 · 1 comment · Fixed by #288
Closed

Make as Variant optional for #[messages(...)] attribtue #168

hashedone opened this issue Jun 9, 2023 · 1 comment · Fixed by #288
Assignees
Labels
enhancement New feature or request

Comments

@hashedone
Copy link
Collaborator

The as Variant part of the #[messages(...)] attribute is used only to generate variant names of glue enum, which does not matter in 99.9% of cases - I can only imagine it is relevant when we would have two modules with very similar names producing the same identifier when converted to CamelCase (or maybe the same name when we use path here). And I think that the as Variant is not used by trait impl at all!

We should make the whole as Variant part optional, and if it is missing, we want to build it by converting the module to the CamelCase variant (for path maybe even some name created by CamelCasing all path parts and then merging them with __? I'm unsure if cargo/clippy would complain, but we can always silence this particular warning with #[allow] I think).

Additionally, I would add a warning if as Variant is used with the same identifier as it would be generated from the module name.

@kulikthebird
Copy link
Contributor

According to proc_macro_error warnings emitting is supported only on nightly rust at the moment. The code itself will emit warnings once they're supported in proc macros

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 a pull request may close this issue.

2 participants