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

[0.7] #[component] attribute doesn't work with clippy::must_use_candidate #3172

Open
zroug opened this issue Oct 28, 2024 · 1 comment
Open

Comments

@zroug
Copy link
Contributor

zroug commented Oct 28, 2024

Describe the bug

Leptos 0.7.0-rc0 #[component] attribute is incompatible with the clippy::must_use_candidate lint.

Leptos Dependencies

leptos = { version = "0.7.0-rc0", features = ["nightly", "experimental-islands"] }
leptos_axum = { version = "0.7.0-rc0", optional = true }
leptos_router = { version = "0.7.0-rc0", features = ["nightly"] }

To Reproduce
Steps to reproduce the behavior:

  1. Enable the clippy::must_use_candidate lint.
  2. Create a component with the #[component] attribute.

Expected behavior
There should be no Clippy warning. There are at least three ways to achieve this:

  1. Add the #[must_use] attribute to the component function. (My preferred option.)
  2. Suppress the lint by adding #[allow(clippy::must_use_candidate)] to the component function.
  3. Do not prevent the warning, but pass the #[must_use] attribute to the generated component function if the user adds the attribute manually.
@gbj
Copy link
Collaborator

gbj commented Oct 29, 2024

A PR for Option 3 is welcome (passing through a user-provided attribute), but it probably shouldn't be special-cased; the component macro should likely just pass through most or all attributes to the __NameOfComponent function that is used to improve rust-analyzer support.

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

No branches or pull requests

2 participants