Skip to content

Commit 311f948

Browse files
targrubItsDoot
authored andcommitted
Fix CI issues arising from use of Rust 1.64 (bevyengine#6067)
## Objective Fixes bevyengine#6063 ## Solution - Use `then_some(x)` instead of `then( || x)`. - Updated error logs from `bevy_ecs_compile_fail_tests`. ## Migration Guide From Rust 1.63 to 1.64, a new Clippy error was added; now one should use `then_some(x)` instead of `then( || x)`.
1 parent 95498d0 commit 311f948

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

crates/bevy_ecs/src/component.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl ComponentDescriptor {
294294
is_send_and_sync: true,
295295
type_id: Some(TypeId::of::<T>()),
296296
layout: Layout::new::<T>(),
297-
drop: needs_drop::<T>().then(|| Self::drop_ptr::<T> as _),
297+
drop: needs_drop::<T>().then_some(Self::drop_ptr::<T> as _),
298298
}
299299
}
300300

@@ -331,7 +331,7 @@ impl ComponentDescriptor {
331331
is_send_and_sync: true,
332332
type_id: Some(TypeId::of::<T>()),
333333
layout: Layout::new::<T>(),
334-
drop: needs_drop::<T>().then(|| Self::drop_ptr::<T> as _),
334+
drop: needs_drop::<T>().then_some(Self::drop_ptr::<T> as _),
335335
}
336336
}
337337

@@ -342,7 +342,7 @@ impl ComponentDescriptor {
342342
is_send_and_sync: false,
343343
type_id: Some(TypeId::of::<T>()),
344344
layout: Layout::new::<T>(),
345-
drop: needs_drop::<T>().then(|| Self::drop_ptr::<T> as _),
345+
drop: needs_drop::<T>().then_some(Self::drop_ptr::<T> as _),
346346
}
347347
}
348348

crates/bevy_ecs/src/entity/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl Entities {
547547
// If this entity was manually created, then free_cursor might be positive
548548
// Returning None handles that case correctly
549549
let num_pending = usize::try_from(-free_cursor).ok()?;
550-
(idu < self.meta.len() + num_pending).then(|| Entity { generation: 0, id })
550+
(idu < self.meta.len() + num_pending).then_some(Entity { generation: 0, id })
551551
}
552552
}
553553

crates/bevy_ecs_compile_fail_tests/tests/ui/query_combin_exact_sized_iterator_safety.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ error[E0277]: the trait bound `bevy_ecs::query::Changed<Foo>: ArchetypeFilter` i
1717
(F0, F1, F2, F3, F4, F5, F6, F7)
1818
and 26 others
1919
= note: required because of the requirements on the impl of `ArchetypeFilter` for `bevy_ecs::query::Or<(bevy_ecs::query::Changed<Foo>, bevy_ecs::query::With<Bar>)>`
20-
= note: required because of the requirements on the impl of `ExactSizeIterator` for `QueryCombinationIter<'_, '_, &Foo, bevy_ecs::query::Or<(bevy_ecs::query::Changed<Foo>, bevy_ecs::query::With<Bar>)>, 2_usize>`
20+
= note: required because of the requirements on the impl of `ExactSizeIterator` for `QueryCombinationIter<'_, '_, &Foo, bevy_ecs::query::Or<(bevy_ecs::query::Changed<Foo>, bevy_ecs::query::With<Bar>)>, 2>`
2121
note: required by a bound in `is_exact_size_iterator`
2222
--> tests/ui/query_combin_exact_sized_iterator_safety.rs:18:30
2323
|
@@ -43,7 +43,7 @@ error[E0277]: the trait bound `bevy_ecs::query::Added<Foo>: ArchetypeFilter` is
4343
(F0, F1, F2, F3, F4, F5, F6, F7)
4444
and 26 others
4545
= note: required because of the requirements on the impl of `ArchetypeFilter` for `(bevy_ecs::query::Added<Foo>, bevy_ecs::query::Without<Bar>)`
46-
= note: required because of the requirements on the impl of `ExactSizeIterator` for `QueryCombinationIter<'_, '_, &Foo, (bevy_ecs::query::Added<Foo>, bevy_ecs::query::Without<Bar>), 2_usize>`
46+
= note: required because of the requirements on the impl of `ExactSizeIterator` for `QueryCombinationIter<'_, '_, &Foo, (bevy_ecs::query::Added<Foo>, bevy_ecs::query::Without<Bar>), 2>`
4747
note: required by a bound in `is_exact_size_iterator`
4848
--> tests/ui/query_combin_exact_sized_iterator_safety.rs:18:30
4949
|

crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_combinations_mut_iterator_safety.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ error[E0277]: the trait bound `&mut A: ReadOnlyWorldQuery` is not satisfied
1717
(F0, F1, F2, F3, F4, F5, F6)
1818
and 49 others
1919
= note: `ReadOnlyWorldQuery` is implemented for `&A`, but not for `&mut A`
20-
= note: required because of the requirements on the impl of `Iterator` for `QueryCombinationIter<'_, '_, &mut A, (), {_: usize}>`
20+
= note: required because of the requirements on the impl of `Iterator` for `QueryCombinationIter<'_, '_, &mut A, (), _>`
2121
note: required by a bound in `is_iterator`
2222
--> tests/ui/query_iter_combinations_mut_iterator_safety.rs:13:19
2323
|

crates/bevy_ecs_compile_fail_tests/tests/ui/query_iter_many_mut_iterator_safety.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ error[E0277]: the trait bound `&mut A: ReadOnlyWorldQuery` is not satisfied
1717
(F0, F1, F2, F3, F4, F5, F6)
1818
and 49 others
1919
= note: `ReadOnlyWorldQuery` is implemented for `&A`, but not for `&mut A`
20-
= note: required because of the requirements on the impl of `Iterator` for `QueryManyIter<'_, '_, &mut A, (), std::array::IntoIter<bevy_ecs::entity::Entity, 1_usize>>`
20+
= note: required because of the requirements on the impl of `Iterator` for `QueryManyIter<'_, '_, &mut A, (), std::array::IntoIter<bevy_ecs::entity::Entity, 1>>`
2121
note: required by a bound in `is_iterator`
2222
--> tests/ui/query_iter_many_mut_iterator_safety.rs:13:19
2323
|

crates/bevy_window/src/system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn close_on_esc(
4444
) {
4545
// TODO: Track this in e.g. a resource to ensure consistent behaviour across similar systems
4646
for event in focused_events.iter() {
47-
*focused = event.focused.then(|| event.id);
47+
*focused = event.focused.then_some(event.id);
4848
}
4949

5050
if let Some(focused) = &*focused {

tools/build-example-pages/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fn parse_examples(panic_on_missing: bool) -> Vec<Example> {
112112
.get(&technical_name)
113113
.and_then(|metadata| metadata.get("hidden"))
114114
.and_then(|hidden| hidden.as_bool())
115-
.and_then(|hidden| hidden.then(|| ()))
115+
.and_then(|hidden| hidden.then_some(()))
116116
.is_some()
117117
{
118118
return None;

0 commit comments

Comments
 (0)