Skip to content

Commit 8821eda

Browse files
authored
Don't use [!Default; 0]: Default impl (#21660)
# Objective - See rust-lang/rust#145457, we want to remove unconditional `[T; 0]: Default` impl. That would be a breaking change breaking `bevy_ecs` and (a test of) `bevy_camera`. ## Solution - Replace `<[T; 0]>::default()` calls with `[]` ## Testing - It compiles, the `<[T; 0]>::default()` is equivalent to `[]`, no additional testing required
1 parent 5530e8f commit 8821eda

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crates/bevy_camera/src/primitives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ mod tests {
652652

653653
#[test]
654654
fn aabb_enclosing() {
655-
assert_eq!(Aabb::enclosing(<[Vec3; 0]>::default()), None);
655+
assert_eq!(Aabb::enclosing([] as [Vec3; 0]), None);
656656
assert_eq!(
657657
Aabb::enclosing(vec![Vec3::ONE]).unwrap(),
658658
Aabb::from_min_max(Vec3::ONE, Vec3::ONE)

crates/bevy_ecs/src/entity/unique_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<T: EntityEquivalent, const N: usize> DerefMut for UniqueEntityEquivalentArr
157157

158158
impl<T: EntityEquivalent> Default for UniqueEntityEquivalentArray<T, 0> {
159159
fn default() -> Self {
160-
Self(Default::default())
160+
Self([])
161161
}
162162
}
163163

0 commit comments

Comments
 (0)