-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix clippy::needless_lifetimes
for most crates
#15907
Conversation
@@ -58,7 +58,7 @@ pub struct PlaybackRemoveMarker; | |||
pub(crate) struct EarPositions<'w, 's> { | |||
pub(crate) query: Query<'w, 's, (Entity, &'static GlobalTransform, &'static SpatialListener)>, | |||
} | |||
impl<'w, 's> EarPositions<'w, 's> { | |||
impl EarPositions<'_, '_> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is substantially less clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide a reasoning, @alice-i-cecile? I agree with your other ones, but this one seems to me like an improvement to conciseness with no loss in clarity.
@@ -176,7 +176,7 @@ fn despawn_descendants_inner<'v, 'w>( | |||
world | |||
} | |||
|
|||
impl<'w> DespawnRecursiveExt for EntityWorldMut<'w> { | |||
impl DespawnRecursiveExt for EntityWorldMut<'_> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much less clear. The 'w lifetime has semantic meaning here.
@@ -214,7 +214,7 @@ where | |||
} | |||
} | |||
|
|||
impl<'w, 's, D: QueryData, F: QueryFilter> Iterator for DescendantIter<'w, 's, D, F> | |||
impl<'w, D: QueryData, F: QueryFilter> Iterator for DescendantIter<'w, '_, D, F> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really dislike this change too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this change because there is still a lifetime parameter, so it's weird to switch between eliding and not eliding.
@@ -11,7 +11,7 @@ impl PartialEq<Symbol> for Ident { | |||
} | |||
} | |||
|
|||
impl<'a> PartialEq<Symbol> for &'a Ident { | |||
impl PartialEq<Symbol> for &Ident { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change.
After, looking at the 3 PRs in this group, I don't think we should do this. These are a serious downgrade in some cases (actual named lifetimes + 'w/'s), neutral in most cases and positive in a very small fraction of cases. There's important information being lost here in favor of a meaningless anonymous lifetime. I'd prefer to close these PRs and blanket ignore the lint if it gets stabilized. I'll file an issue on the clippy repo too. |
@@ -214,7 +214,7 @@ where | |||
} | |||
} | |||
|
|||
impl<'w, 's, D: QueryData, F: QueryFilter> Iterator for DescendantIter<'w, 's, D, F> | |||
impl<'w, D: QueryData, F: QueryFilter> Iterator for DescendantIter<'w, '_, D, F> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this change because there is still a lifetime parameter, so it's weird to switch between eliding and not eliding.
@@ -259,7 +259,7 @@ where | |||
} | |||
} | |||
|
|||
impl<'w, 's, D: QueryData, F: QueryFilter> Iterator for DescendantDepthFirstIter<'w, 's, D, F> | |||
impl<'w, D: QueryData, F: QueryFilter> Iterator for DescendantDepthFirstIter<'w, '_, D, F> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
@@ -298,7 +298,7 @@ where | |||
} | |||
} | |||
|
|||
impl<'w, 's, D: QueryData, F: QueryFilter> Iterator for AncestorIter<'w, 's, D, F> | |||
impl<'w, D: QueryData, F: QueryFilter> Iterator for AncestorIter<'w, '_, D, F> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
@@ -602,7 +602,7 @@ pub struct Scope<'scope, 'env: 'scope, T> { | |||
env: PhantomData<&'env mut &'env ()>, | |||
} | |||
|
|||
impl<'scope, 'env, T: Send + 'scope> Scope<'scope, 'env, T> { | |||
impl<'scope, T: Send + 'scope> Scope<'scope, '_, T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
@@ -655,7 +655,7 @@ impl<'scope, 'env, T: Send + 'scope> Scope<'scope, 'env, T> { | |||
} | |||
} | |||
|
|||
impl<'scope, 'env, T> Drop for Scope<'scope, 'env, T> | |||
impl<'scope, T> Drop for Scope<'scope, '_, T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
@@ -30,7 +30,7 @@ pub struct UiRootNodes<'w, 's> { | |||
ui_children: UiChildren<'w, 's>, | |||
} | |||
|
|||
impl<'w, 's> UiRootNodes<'w, 's> { | |||
impl<'s> UiRootNodes<'_, 's> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
I'm going to checkout this commit and play with the code a bit to see if I can do better than clippy at eliding the remaining lifetime parameters. Probably not. |
Part "2" for #15906. This fixes
clippy::needless_lifetimes
for all crates exceptbevy_reflect
andbevy_ecs
, to reduce the amount of code to review.I say "2" in quotes because all the lint fixes can be merged separately, and don't depend on each other. Although all of them are required to truly make
ci lints
pass without errors.