internals: Implement Default for ArrayVec

In an unrelated PR CI run we got the following error:

```
error: you should consider adding a `Default` implementation for `ArrayVec<T, CAP>`
```

I did not bother to dig any deeper since this seems like a reasonable
suggestion by the compiler since we provide a `new` function that takes
zero arguments.

Add a `Default` implementation to `ArrayVec`.
This commit is contained in:
Tobin C. Harding 2024-02-28 13:19:43 +11:00
parent 36aa627d83
commit a55e78a28d
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 4 additions and 0 deletions

View File

@ -95,6 +95,10 @@ mod safety_boundary {
}
}
impl<T: Copy, const CAP: usize> Default for ArrayVec<T, CAP> {
fn default() -> Self { Self::new() }
}
/// Clones the value *faster* than using `Copy`.
///
/// Because we avoid copying the uninitialized part of the array this copies the value faster than