-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingT-async-awaitType: Issues related to async/awaitType: Issues related to async/await
Description
Output of cargo clippy -V
:
clippy 0.0.212 (4e7e71b 2019-10-11)
I have a method that looks like this:
pub async fn wait<'a, T>(&self, guard: MutexGuard<'a, T>) -> MutexGuard<'a, T> {
let mutex = guard_lock(&guard);
self.await_notify(guard).await;
mutex.lock().await
}
Clippy flags the signature for needless lifetimes. However, replacing the 'a
lifteime with the anonymous '_
as suggested, results in a lifetime mismatch error, because the lifetime of the return value comes from the guard argument, not self. As far as I understand, lifetimes cannot be elided here.
ivan
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingT-async-awaitType: Issues related to async/awaitType: Issues related to async/await