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

Macro-generated false positive for clippy::needless_arbitrary_self_type #277

Closed
adamspofford-dfinity opened this issue Sep 24, 2024 · 0 comments · Fixed by #278
Closed

Comments

@adamspofford-dfinity
Copy link

I am implementing an async trait for all T where &T: tower::Service<...>. Since Service::execute takes &mut self, this trait impl says mut self: &Self (since you cannot say mut &self). This is fine with a plain async trait, but #[async_trait] triggers the clippy lint:

warning: the type of the `self` parameter does not need to be arbitrary
    --> ic-agent/src/agent/mod.rs:1865:13
     |
1865 |         mut self: &'a Self,
     |             ^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'a self`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_arbitrary_self_type
     = note: `#[warn(clippy::needless_arbitrary_self_type)]` on by default

because the generated code starts with &self and let-binds it later. It would be good if async_trait silenced the warning instead of the caller.

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.

1 participant