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

Clippy throws needless_lifetimes on components with lifetime parameter #1825

Closed
srid opened this issue Oct 2, 2023 · 1 comment · Fixed by #1852
Closed

Clippy throws needless_lifetimes on components with lifetime parameter #1825

srid opened this issue Oct 2, 2023 · 1 comment · Fixed by #1852
Labels
bug Something isn't working

Comments

@srid
Copy link
Contributor

srid commented Oct 2, 2023

Describe the bug
In leptos 0.4, I write a component taking a reference like this:

#[component]
fn FlakeView<'a>(flake: &'a Flake) -> impl IntoView {

The same is true for leptos 0.5 ― without explicit 'a, the compiler will complain error[E0106]: missing lifetime specifier.

However in 0.5 (but not in 0.4) clippy started complaining about this lifetime parameter being "needless" when it is in fact needed.

warning: the following explicit lifetimes could be elided: 'a
  --> src/app/flake.rs:87:14
   |
87 | fn FlakeView<'a>(flake: &'a Flake) -> impl IntoView {
   |              ^^          ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
87 - fn FlakeView<'a>(flake: &'a Flake) -> impl IntoView {
87 + fn FlakeView(flake: &Flake) -> impl IntoView {

Did something change in the component macro?

Leptos Dependencies

leptos = { version = "0.5", features = ["serde", "nightly"] }
leptos_meta = { version = "0.5", features = ["nightly"] }
leptos_router = { version = "0.5", features = ["nightly"] }
leptos_query = "0.3"

To Reproduce

Run nix develop -c cargo clippy in juspay/omnix#78 (commit bf90433)

Expected behavior

cargo clippy should succeed without warnings.

Screenshots

image

@gbj
Copy link
Collaborator

gbj commented Oct 6, 2023

Thanks! I think this #[allow] just disappeared at some point, the PR should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants