Merge rust-bitcoin/rust-bitcoin#2512: internals: Implement Default for ArrayVec
a55e78a28d
internals: Implement Default for ArrayVec (Tobin C. Harding) Pull request description: 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`. ACKs for top commit: apoelstra: ACKa55e78a28d
Kixunil: ACKa55e78a28d
Tree-SHA512: 85b8248ca3b6d098eeb65042d89f69fc359ef1d167c52abf321b5a6597c0a8d44cd7383668b959c2082156214a47a61478d725431718c41f23f3ca48fb274342
This commit is contained in:
commit
1f3d05ea98
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue