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

Fix clippy::needless_lifetimes for most crates #15907

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/bevy_asset/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ impl<'a> SliceReader<'a> {
}
}

impl<'a> AsyncRead for SliceReader<'a> {
impl AsyncRead for SliceReader<'_> {
fn poll_read(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand All @@ -669,7 +669,7 @@ impl<'a> AsyncRead for SliceReader<'a> {
}
}

impl<'a> AsyncSeekForward for SliceReader<'a> {
impl AsyncSeekForward for SliceReader<'_> {
fn poll_seek_forward(
mut self: Pin<&mut Self>,
_cx: &mut Context<'_>,
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_asset/src/io/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub enum AssetSourceId<'a> {
Name(CowArc<'a, str>),
}

impl<'a> Display for AssetSourceId<'a> {
impl Display for AssetSourceId<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.as_str() {
None => write!(f, "AssetSourceId::Default"),
Expand Down Expand Up @@ -114,13 +114,13 @@ impl From<String> for AssetSourceId<'static> {
}
}

impl<'a> Hash for AssetSourceId<'a> {
impl Hash for AssetSourceId<'_> {
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
self.as_str().hash(state);
}
}

impl<'a> PartialEq for AssetSourceId<'a> {
impl PartialEq for AssetSourceId<'_> {
fn eq(&self, other: &Self) -> bool {
self.as_str().eq(&other.as_str())
}
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_asset/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ pub struct AssetPath<'a> {
label: Option<CowArc<'a, str>>,
}

impl<'a> Debug for AssetPath<'a> {
impl Debug for AssetPath<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
Display::fmt(self, f)
}
}

impl<'a> Display for AssetPath<'a> {
impl Display for AssetPath<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
if let AssetSourceId::Name(name) = self.source() {
write!(f, "{name}://")?;
Expand Down Expand Up @@ -565,7 +565,7 @@ impl<'a> From<AssetPath<'a>> for PathBuf {
}
}

impl<'a> Serialize for AssetPath<'a> {
impl Serialize for AssetPath<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand All @@ -585,7 +585,7 @@ impl<'de> Deserialize<'de> for AssetPath<'static> {

struct AssetPathVisitor;

impl<'de> Visitor<'de> for AssetPathVisitor {
impl Visitor<'_> for AssetPathVisitor {
type Value = AssetPath<'static>;

fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/saver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct SavedAsset<'a, A: Asset> {
labeled_assets: &'a HashMap<CowArc<'static, str>, LabeledAsset>,
}

impl<'a, A: Asset> Deref for SavedAsset<'a, A> {
impl<A: Asset> Deref for SavedAsset<'_, A> {
type Target = A;

fn deref(&self) -> &Self::Target {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_asset/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ pub struct TransformedSubAsset<'a, A: Asset> {
labeled_assets: &'a mut HashMap<CowArc<'static, str>, LabeledAsset>,
}

impl<'a, A: Asset> Deref for TransformedSubAsset<'a, A> {
impl<A: Asset> Deref for TransformedSubAsset<'_, A> {
type Target = A;
fn deref(&self) -> &Self::Target {
self.value
}
}

impl<'a, A: Asset> DerefMut for TransformedSubAsset<'a, A> {
impl<A: Asset> DerefMut for TransformedSubAsset<'_, A> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.value
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_audio/src/audio_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<'_, '_> {
Copy link
Member

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.

Copy link
Contributor

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.

/// Gets a set of transformed ear positions.
///
/// If there are no listeners, use the default values. If a user has added multiple
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core/src/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub struct NameOrEntity {
pub entity: Entity,
}

impl<'a> core::fmt::Display for NameOrEntityItem<'a> {
impl core::fmt::Display for NameOrEntityItem<'_> {
#[inline(always)]
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.name {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_core/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<'de> Deserialize<'de> for Name {

struct EntityVisitor;

impl<'de> Visitor<'de> for EntityVisitor {
impl Visitor<'_> for EntityVisitor {
type Value = Name;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
Expand Down Expand Up @@ -55,7 +55,7 @@ impl<'de> Deserialize<'de> for FrameCount {

struct FrameVisitor;

impl<'de> Visitor<'de> for FrameVisitor {
impl Visitor<'_> for FrameVisitor {
type Value = FrameCount;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_diagnostic/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ pub struct Diagnostics<'w, 's> {
queue: Deferred<'s, DiagnosticsBuffer>,
}

impl<'w, 's> Diagnostics<'w, 's> {
impl Diagnostics<'_, '_> {
/// Add a measurement to an enabled [`Diagnostic`]. The measurement is passed as a function so that
/// it will be evaluated only if the [`Diagnostic`] is enabled. This can be useful if the value is
/// costly to calculate.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_gizmos/src/arrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ where
}
}

impl<'w, 's, Config, Clear> Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_gizmos/src/curves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy_math::{curve::Curve, Vec2, Vec3};

use crate::prelude::{GizmoConfigGroup, Gizmos};

impl<'w, 's, Config, Clear> Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_gizmos/src/gizmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ where
}
}

impl<'w, 's, Config, Clear> Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down
31 changes: 15 additions & 16 deletions crates/bevy_gizmos/src/primitives/dim2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub trait GizmoPrimitive2d<P: Primitive2d> {

// direction 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<Dir2> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<Dir2> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -68,7 +68,7 @@ where

// arc 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<Arc2d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<Arc2d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -124,7 +124,7 @@ where

// circular sector 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<CircularSector> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<CircularSector> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -167,7 +167,7 @@ where

// circular segment 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<CircularSegment> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<CircularSegment> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -331,7 +331,7 @@ where

// rhombus 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<Rhombus> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<Rhombus> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -365,7 +365,7 @@ where

// capsule 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<Capsule2d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<Capsule2d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -516,7 +516,7 @@ where

// plane 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<Plane2d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<Plane2d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -651,8 +651,8 @@ where

// polyline 2d

impl<'w, 's, const N: usize, Config, Clear> GizmoPrimitive2d<Polyline2d<N>>
for Gizmos<'w, 's, Config, Clear>
impl<const N: usize, Config, Clear> GizmoPrimitive2d<Polyline2d<N>>
for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -687,7 +687,7 @@ where

// boxed polyline 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<BoxedPolyline2d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<BoxedPolyline2d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -722,7 +722,7 @@ where

// triangle 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<Triangle2d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<Triangle2d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -752,7 +752,7 @@ where

// rectangle 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<Rectangle> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<Rectangle> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -788,8 +788,7 @@ where

// polygon 2d

impl<'w, 's, const N: usize, Config, Clear> GizmoPrimitive2d<Polygon<N>>
for Gizmos<'w, 's, Config, Clear>
impl<const N: usize, Config, Clear> GizmoPrimitive2d<Polygon<N>> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -834,7 +833,7 @@ where

// boxed polygon 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<BoxedPolygon> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<BoxedPolygon> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -877,7 +876,7 @@ where

// regular polygon 2d

impl<'w, 's, Config, Clear> GizmoPrimitive2d<RegularPolygon> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive2d<RegularPolygon> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down
18 changes: 9 additions & 9 deletions crates/bevy_gizmos/src/primitives/dim3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub trait GizmoPrimitive3d<P: Primitive3d> {

// direction 3d

impl<'w, 's, Config, Clear> GizmoPrimitive3d<Dir3> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive3d<Dir3> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -176,7 +176,7 @@ where

// line 3d

impl<'w, 's, Config, Clear> GizmoPrimitive3d<Line3d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive3d<Line3d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -211,7 +211,7 @@ where

// segment 3d

impl<'w, 's, Config, Clear> GizmoPrimitive3d<Segment3d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive3d<Segment3d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -239,8 +239,8 @@ where

// polyline 3d

impl<'w, 's, const N: usize, Config, Clear> GizmoPrimitive3d<Polyline3d<N>>
for Gizmos<'w, 's, Config, Clear>
impl<const N: usize, Config, Clear> GizmoPrimitive3d<Polyline3d<N>>
for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand All @@ -267,7 +267,7 @@ where

// boxed polyline 3d

impl<'w, 's, Config, Clear> GizmoPrimitive3d<BoxedPolyline3d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive3d<BoxedPolyline3d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -301,7 +301,7 @@ where

// triangle 3d

impl<'w, 's, Config, Clear> GizmoPrimitive3d<Triangle3d> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive3d<Triangle3d> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -329,7 +329,7 @@ where

// cuboid

impl<'w, 's, Config, Clear> GizmoPrimitive3d<Cuboid> for Gizmos<'w, 's, Config, Clear>
impl<Config, Clear> GizmoPrimitive3d<Cuboid> for Gizmos<'_, '_, Config, Clear>
where
Config: GizmoConfigGroup,
Clear: 'static + Send + Sync,
Expand Down Expand Up @@ -936,7 +936,7 @@ where

// tetrahedron

impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Tetrahedron> for Gizmos<'w, 's, T> {
impl<T: GizmoConfigGroup> GizmoPrimitive3d<Tetrahedron> for Gizmos<'_, '_, T> {
type Output<'a>
= ()
where
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,7 @@ impl<'a> Iterator for GltfTreeIterator<'a> {
}
}

impl<'a> ExactSizeIterator for GltfTreeIterator<'a> {
impl ExactSizeIterator for GltfTreeIterator<'_> {
fn len(&self) -> usize {
self.nodes.len()
}
Expand Down Expand Up @@ -1992,7 +1992,7 @@ pub(super) struct PrimitiveMorphAttributesIter<'s>(
Option<Iter<'s, [f32; 3]>>,
),
);
impl<'s> Iterator for PrimitiveMorphAttributesIter<'s> {
impl Iterator for PrimitiveMorphAttributesIter<'_> {
type Item = MorphAttributes;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
Loading
Loading