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

rust-analyzer reports a warning arising from proc-macro #676

Closed
mtshr opened this issue Jul 10, 2024 · 0 comments · Fixed by #677
Closed

rust-analyzer reports a warning arising from proc-macro #676

mtshr opened this issue Jul 10, 2024 · 0 comments · Fixed by #677

Comments

@mtshr
Copy link
Contributor

mtshr commented Jul 10, 2024

Describe the bug

rust-analyzer reports a warning arising from the proc-macro.

To Reproduce

Follow the hello world example and write the source code in Visual Studio Code with rust-analyzer.
https://sycamore-rs.netlify.app/docs/getting_started/hello_world

Expected behavior

No warnings emitted.

Screenshots

Screenshot from 2024-07-10 21-16-27

Environment

  • Sycamore: "0.9.0-beta.2"
  • Browser: N/A
  • OS: Ubuntu 22.04.4 LTS
  • rust-analyzer: v0.3.2029
  • Visual Studio Code: 1.91.0

Additional context

This warning is not emitted during the build process with cargo, so is not caught in github actions.

Suggestion

Basically, I do not want to put an [allow(non_snake_case_types)] attribute in my source code, so let me suggest adding the attribute to the type alias in question in sycamore-macro crate, or renaming the type alias like below.

quote! {{
type __tag = ::sycamore::web::html::#tag;
::sycamore::generic_node::TemplateShape::Element {
tag: __tag::TAG_NAME,
ns: __tag::NAMESPACE,
children: &[#(#children),*],
attributes: &[#(#attrs),*],
flag: #flag,
}
}}

                quote! {{
-                    type __tag = ::sycamore::web::html::#tag;
+                    type __Tag = ::sycamore::web::html::#tag;
                    ::sycamore::generic_node::TemplateShape::Element {
-                        tag: __tag::TAG_NAME,
-                        ns: __tag::NAMESPACE,
+                        tag: __Tag::TAG_NAME,
+                        ns: __Tag::NAMESPACE,
                        children: &[#(#children),*],
                        attributes: &[#(#attrs),*],
                        flag: #flag,
                    }
                }}
@lukechu10 lukechu10 linked a pull request Jul 12, 2024 that will close this issue
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 a pull request may close this issue.

2 participants