diff --git a/crates/bevy_ecs/src/component.rs b/crates/bevy_ecs/src/component.rs index eb379934ef..c59a1e2028 100644 --- a/crates/bevy_ecs/src/component.rs +++ b/crates/bevy_ecs/src/component.rs @@ -294,7 +294,7 @@ impl ComponentDescriptor { is_send_and_sync: true, type_id: Some(TypeId::of::()), layout: Layout::new::(), - drop: needs_drop::().then(|| Self::drop_ptr:: as _), + drop: needs_drop::().then_some(Self::drop_ptr:: as _), } } @@ -331,7 +331,7 @@ impl ComponentDescriptor { is_send_and_sync: true, type_id: Some(TypeId::of::()), layout: Layout::new::(), - drop: needs_drop::().then(|| Self::drop_ptr:: as _), + drop: needs_drop::().then_some(Self::drop_ptr:: as _), } } @@ -342,7 +342,7 @@ impl ComponentDescriptor { is_send_and_sync: false, type_id: Some(TypeId::of::()), layout: Layout::new::(), - drop: needs_drop::().then(|| Self::drop_ptr:: as _), + drop: needs_drop::().then_some(Self::drop_ptr:: as _), } } diff --git a/crates/bevy_ecs/src/entity/mod.rs b/crates/bevy_ecs/src/entity/mod.rs index 6ccf5a2150..2d2f859218 100644 --- a/crates/bevy_ecs/src/entity/mod.rs +++ b/crates/bevy_ecs/src/entity/mod.rs @@ -547,7 +547,7 @@ impl Entities { // If this entity was manually created, then free_cursor might be positive // Returning None handles that case correctly let num_pending = usize::try_from(-free_cursor).ok()?; - (idu < self.meta.len() + num_pending).then(|| Entity { generation: 0, id }) + (idu < self.meta.len() + num_pending).then_some(Entity { generation: 0, id }) } } diff --git a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_combin_exact_sized_iterator_safety.stderr b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_combin_exact_sized_iterator_safety.stderr index 3de9d2c089..62056278cd 100644 --- a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_combin_exact_sized_iterator_safety.stderr +++ b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_combin_exact_sized_iterator_safety.stderr @@ -17,7 +17,7 @@ error[E0277]: the trait bound `bevy_ecs::query::Changed: ArchetypeFilter` i (F0, F1, F2, F3, F4, F5, F6, F7) and 26 others = note: required because of the requirements on the impl of `ArchetypeFilter` for `bevy_ecs::query::Or<(bevy_ecs::query::Changed, bevy_ecs::query::With)>` - = note: required because of the requirements on the impl of `ExactSizeIterator` for `QueryCombinationIter<'_, '_, &Foo, bevy_ecs::query::Or<(bevy_ecs::query::Changed, bevy_ecs::query::With)>, 2_usize>` + = note: required because of the requirements on the impl of `ExactSizeIterator` for `QueryCombinationIter<'_, '_, &Foo, bevy_ecs::query::Or<(bevy_ecs::query::Changed, bevy_ecs::query::With)>, 2>` note: required by a bound in `is_exact_size_iterator` --> tests/ui/query_combin_exact_sized_iterator_safety.rs:18:30 | @@ -43,7 +43,7 @@ error[E0277]: the trait bound `bevy_ecs::query::Added: ArchetypeFilter` is (F0, F1, F2, F3, F4, F5, F6, F7) and 26 others = note: required because of the requirements on the impl of `ArchetypeFilter` for `(bevy_ecs::query::Added, bevy_ecs::query::Without)` - = note: required because of the requirements on the impl of `ExactSizeIterator` for `QueryCombinationIter<'_, '_, &Foo, (bevy_ecs::query::Added, bevy_ecs::query::Without), 2_usize>` + = note: required because of the requirements on the impl of `ExactSizeIterator` for `QueryCombinationIter<'_, '_, &Foo, (bevy_ecs::query::Added, bevy_ecs::query::Without), 2>` note: required by a bound in `is_exact_size_iterator` --> tests/ui/query_combin_exact_sized_iterator_safety.rs:18:30 | diff --git a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr index 7cd36eadcf..d374bf6f64 100644 --- a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr +++ b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr @@ -17,7 +17,7 @@ error[E0277]: the trait bound `&mut A: ReadOnlyWorldQuery` is not satisfied (F0, F1, F2, F3, F4, F5, F6) and 49 others = note: `ReadOnlyWorldQuery` is implemented for `&A`, but not for `&mut A` - = note: required because of the requirements on the impl of `Iterator` for `QueryCombinationIter<'_, '_, &mut A, (), {_: usize}>` + = note: required because of the requirements on the impl of `Iterator` for `QueryCombinationIter<'_, '_, &mut A, (), _>` note: required by a bound in `is_iterator` --> tests/ui/query_iter_combinations_mut_iterator_safety.rs:13:19 | diff --git a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr index 45840aa323..b5662900ee 100644 --- a/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr +++ b/crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr @@ -17,7 +17,7 @@ error[E0277]: the trait bound `&mut A: ReadOnlyWorldQuery` is not satisfied (F0, F1, F2, F3, F4, F5, F6) and 49 others = note: `ReadOnlyWorldQuery` is implemented for `&A`, but not for `&mut A` - = note: required because of the requirements on the impl of `Iterator` for `QueryManyIter<'_, '_, &mut A, (), std::array::IntoIter>` + = note: required because of the requirements on the impl of `Iterator` for `QueryManyIter<'_, '_, &mut A, (), std::array::IntoIter>` note: required by a bound in `is_iterator` --> tests/ui/query_iter_many_mut_iterator_safety.rs:13:19 | diff --git a/crates/bevy_window/src/system.rs b/crates/bevy_window/src/system.rs index 45a374fe2e..6cb17b877a 100644 --- a/crates/bevy_window/src/system.rs +++ b/crates/bevy_window/src/system.rs @@ -44,7 +44,7 @@ pub fn close_on_esc( ) { // TODO: Track this in e.g. a resource to ensure consistent behaviour across similar systems for event in focused_events.iter() { - *focused = event.focused.then(|| event.id); + *focused = event.focused.then_some(event.id); } if let Some(focused) = &*focused { diff --git a/tools/build-example-pages/src/main.rs b/tools/build-example-pages/src/main.rs index b64530a97b..f480cc788a 100644 --- a/tools/build-example-pages/src/main.rs +++ b/tools/build-example-pages/src/main.rs @@ -112,7 +112,7 @@ fn parse_examples(panic_on_missing: bool) -> Vec { .get(&technical_name) .and_then(|metadata| metadata.get("hidden")) .and_then(|hidden| hidden.as_bool()) - .and_then(|hidden| hidden.then(|| ())) + .and_then(|hidden| hidden.then_some(())) .is_some() { return None;