diff --git a/crates/bevy_asset/src/io/mod.rs b/crates/bevy_asset/src/io/mod.rs index 925192e6dec42..4a8815c4012c2 100644 --- a/crates/bevy_asset/src/io/mod.rs +++ b/crates/bevy_asset/src/io/mod.rs @@ -190,32 +190,35 @@ pub trait ErasedAssetReader: Send + Sync + 'static { fn read<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetReaderError>>; + ) -> BoxedFuture<'a, Result, AssetReaderError>>; /// Returns a future to load the full file data at the provided path. fn read_meta<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetReaderError>>; + ) -> BoxedFuture<'a, Result, AssetReaderError>>; /// Returns an iterator of directory entry names at the provided path. fn read_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetReaderError>>; + ) -> BoxedFuture<'a, Result, AssetReaderError>>; /// Returns true if the provided path points to a directory. - fn is_directory<'a>(&'a self, path: &'a Path) -> BoxedFuture>; + fn is_directory<'a>( + &'a self, + path: &'a Path, + ) -> BoxedFuture<'a, Result>; /// Reads asset metadata bytes at the given `path` into a [`Vec`]. This is a convenience /// function that wraps [`ErasedAssetReader::read_meta`] by default. fn read_meta_bytes<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetReaderError>>; + ) -> BoxedFuture<'a, Result, AssetReaderError>>; } impl ErasedAssetReader for T { fn read<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetReaderError>> { + ) -> BoxedFuture<'a, Result, AssetReaderError>> { Box::pin(async { let reader = Self::read(self, path).await?; Ok(Box::new(reader) as Box) @@ -224,7 +227,7 @@ impl ErasedAssetReader for T { fn read_meta<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetReaderError>> { + ) -> BoxedFuture<'a, Result, AssetReaderError>> { Box::pin(async { let reader = Self::read_meta(self, path).await?; Ok(Box::new(reader) as Box) @@ -233,16 +236,19 @@ impl ErasedAssetReader for T { fn read_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetReaderError>> { + ) -> BoxedFuture<'a, Result, AssetReaderError>> { Box::pin(Self::read_directory(self, path)) } - fn is_directory<'a>(&'a self, path: &'a Path) -> BoxedFuture> { + fn is_directory<'a>( + &'a self, + path: &'a Path, + ) -> BoxedFuture<'a, Result> { Box::pin(Self::is_directory(self, path)) } fn read_meta_bytes<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetReaderError>> { + ) -> BoxedFuture<'a, Result, AssetReaderError>> { Box::pin(Self::read_meta_bytes(self, path)) } } @@ -351,115 +357,127 @@ pub trait AssetWriter: Send + Sync + 'static { /// as [`AssetWriter`] isn't currently object safe. pub trait ErasedAssetWriter: Send + Sync + 'static { /// Writes the full asset bytes at the provided path. - fn write<'a>(&'a self, path: &'a Path) -> BoxedFuture, AssetWriterError>>; + fn write<'a>( + &'a self, + path: &'a Path, + ) -> BoxedFuture<'a, Result, AssetWriterError>>; /// Writes the full asset meta bytes at the provided path. /// This _should not_ include storage specific extensions like `.meta`. fn write_meta<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetWriterError>>; + ) -> BoxedFuture<'a, Result, AssetWriterError>>; /// Removes the asset stored at the given path. - fn remove<'a>(&'a self, path: &'a Path) -> BoxedFuture>; + fn remove<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<(), AssetWriterError>>; /// Removes the asset meta stored at the given path. /// This _should not_ include storage specific extensions like `.meta`. - fn remove_meta<'a>(&'a self, path: &'a Path) -> BoxedFuture>; + fn remove_meta<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<(), AssetWriterError>>; /// Renames the asset at `old_path` to `new_path` fn rename<'a>( &'a self, old_path: &'a Path, new_path: &'a Path, - ) -> BoxedFuture>; + ) -> BoxedFuture<'a, Result<(), AssetWriterError>>; /// Renames the asset meta for the asset at `old_path` to `new_path`. /// This _should not_ include storage specific extensions like `.meta`. fn rename_meta<'a>( &'a self, old_path: &'a Path, new_path: &'a Path, - ) -> BoxedFuture>; + ) -> BoxedFuture<'a, Result<(), AssetWriterError>>; /// Removes the directory at the given path, including all assets _and_ directories in that directory. - fn remove_directory<'a>(&'a self, path: &'a Path) -> BoxedFuture>; + fn remove_directory<'a>( + &'a self, + path: &'a Path, + ) -> BoxedFuture<'a, Result<(), AssetWriterError>>; /// Removes the directory at the given path, but only if it is completely empty. This will return an error if the /// directory is not empty. fn remove_empty_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture>; + ) -> BoxedFuture<'a, Result<(), AssetWriterError>>; /// Removes all assets (and directories) in this directory, resulting in an empty directory. fn remove_assets_in_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture>; + ) -> BoxedFuture<'a, Result<(), AssetWriterError>>; /// Writes the asset `bytes` to the given `path`. fn write_bytes<'a>( &'a self, path: &'a Path, bytes: &'a [u8], - ) -> BoxedFuture>; + ) -> BoxedFuture<'a, Result<(), AssetWriterError>>; /// Writes the asset meta `bytes` to the given `path`. fn write_meta_bytes<'a>( &'a self, path: &'a Path, bytes: &'a [u8], - ) -> BoxedFuture>; + ) -> BoxedFuture<'a, Result<(), AssetWriterError>>; } impl ErasedAssetWriter for T { - fn write<'a>(&'a self, path: &'a Path) -> BoxedFuture, AssetWriterError>> { + fn write<'a>( + &'a self, + path: &'a Path, + ) -> BoxedFuture<'a, Result, AssetWriterError>> { Box::pin(Self::write(self, path)) } fn write_meta<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture, AssetWriterError>> { + ) -> BoxedFuture<'a, Result, AssetWriterError>> { Box::pin(Self::write_meta(self, path)) } - fn remove<'a>(&'a self, path: &'a Path) -> BoxedFuture> { + fn remove<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::remove(self, path)) } - fn remove_meta<'a>(&'a self, path: &'a Path) -> BoxedFuture> { + fn remove_meta<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::remove_meta(self, path)) } fn rename<'a>( &'a self, old_path: &'a Path, new_path: &'a Path, - ) -> BoxedFuture> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::rename(self, old_path, new_path)) } fn rename_meta<'a>( &'a self, old_path: &'a Path, new_path: &'a Path, - ) -> BoxedFuture> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::rename_meta(self, old_path, new_path)) } - fn remove_directory<'a>(&'a self, path: &'a Path) -> BoxedFuture> { + fn remove_directory<'a>( + &'a self, + path: &'a Path, + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::remove_directory(self, path)) } fn remove_empty_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::remove_empty_directory(self, path)) } fn remove_assets_in_directory<'a>( &'a self, path: &'a Path, - ) -> BoxedFuture> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::remove_assets_in_directory(self, path)) } fn write_bytes<'a>( &'a self, path: &'a Path, bytes: &'a [u8], - ) -> BoxedFuture> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::write_bytes(self, path, bytes)) } fn write_meta_bytes<'a>( &'a self, path: &'a Path, bytes: &'a [u8], - ) -> BoxedFuture> { + ) -> BoxedFuture<'a, Result<(), AssetWriterError>> { Box::pin(Self::write_meta_bytes(self, path, bytes)) } } diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index b9ffa1b9149a0..5b7756ab1369e 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -1893,7 +1893,7 @@ impl ScheduleGraph { &'a self, ambiguities: &'a [(NodeId, NodeId, Vec)], components: &'a Components, - ) -> impl Iterator)> + 'a { + ) -> impl Iterator)> + 'a { ambiguities .iter() .map(move |(system_a, system_b, conflicts)| { diff --git a/crates/bevy_reflect/src/array.rs b/crates/bevy_reflect/src/array.rs index 42498da3b6203..f981760df35b8 100644 --- a/crates/bevy_reflect/src/array.rs +++ b/crates/bevy_reflect/src/array.rs @@ -360,10 +360,10 @@ pub struct ArrayIter<'a> { index: usize, } -impl<'a> ArrayIter<'a> { +impl ArrayIter<'_> { /// Creates a new [`ArrayIter`]. #[inline] - pub const fn new(array: &'a dyn Array) -> ArrayIter { + pub const fn new(array: &dyn Array) -> ArrayIter { ArrayIter { array, index: 0 } } } diff --git a/crates/bevy_reflect/src/list.rs b/crates/bevy_reflect/src/list.rs index b44a7e1c0db78..a9b50875c6c44 100644 --- a/crates/bevy_reflect/src/list.rs +++ b/crates/bevy_reflect/src/list.rs @@ -381,10 +381,10 @@ pub struct ListIter<'a> { index: usize, } -impl<'a> ListIter<'a> { +impl ListIter<'_> { /// Creates a new [`ListIter`]. #[inline] - pub const fn new(list: &'a dyn List) -> ListIter { + pub const fn new(list: &dyn List) -> ListIter { ListIter { list, index: 0 } } } @@ -406,7 +406,7 @@ impl<'a> Iterator for ListIter<'a> { } } -impl<'a> ExactSizeIterator for ListIter<'a> {} +impl ExactSizeIterator for ListIter<'_> {} /// Returns the `u64` hash of the given [list](List). #[inline] diff --git a/crates/bevy_reflect/src/map.rs b/crates/bevy_reflect/src/map.rs index 4b192d6b75c97..52c8abee8c619 100644 --- a/crates/bevy_reflect/src/map.rs +++ b/crates/bevy_reflect/src/map.rs @@ -403,10 +403,10 @@ pub struct MapIter<'a> { index: usize, } -impl<'a> MapIter<'a> { +impl MapIter<'_> { /// Creates a new [`MapIter`]. #[inline] - pub const fn new(map: &'a dyn Map) -> MapIter { + pub const fn new(map: &dyn Map) -> MapIter { MapIter { map, index: 0 } } } diff --git a/crates/bevy_reflect/src/path/mod.rs b/crates/bevy_reflect/src/path/mod.rs index afc8c5c28ba09..ced501c15424d 100644 --- a/crates/bevy_reflect/src/path/mod.rs +++ b/crates/bevy_reflect/src/path/mod.rs @@ -421,7 +421,7 @@ impl ParsedPath { /// Similar to [`Self::parse`] but only works on `&'static str` /// and does not allocate per named field. - pub fn parse_static(string: &'static str) -> PathResult { + pub fn parse_static(string: &'static str) -> PathResult<'static, Self> { let mut parts = Vec::new(); for (access, offset) in PathParser::new(string) { parts.push(OffsetAccess { diff --git a/crates/bevy_reflect/src/type_registry.rs b/crates/bevy_reflect/src/type_registry.rs index fa74e51950570..4f39d17c5a097 100644 --- a/crates/bevy_reflect/src/type_registry.rs +++ b/crates/bevy_reflect/src/type_registry.rs @@ -578,7 +578,7 @@ pub trait FromType { /// [`FromType::from_type`]. #[derive(Clone)] pub struct ReflectSerialize { - get_serializable: for<'a> fn(value: &'a dyn Reflect) -> Serializable, + get_serializable: fn(value: &dyn Reflect) -> Serializable, } impl FromType for ReflectSerialize {