fix: avoid unneeded allocation

pull/24376/head
Jake Goulding 2022-11-18 10:57:59 -05:00 committed by Carol (Nichols || Goulding)
parent 651b7a1ce6
commit eb6abb5d67
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
1 changed files with 2 additions and 2 deletions

View File

@ -543,14 +543,14 @@ impl SegmentFileReader {
}
async fn is_segment_stream(f: &mut Pin<Box<dyn AsyncRead>>) -> Result<()> {
let mut header = vec![0u8; FILE_TYPE_IDENTIFIER.len()];
let mut header = [0u8; FILE_TYPE_IDENTIFIER.len()];
f.read_exact(&mut header)
.await
.context(UnableToReadFileMetadataSnafu)?;
ensure!(
header == FILE_TYPE_IDENTIFIER,
SegmentFileIdentifierMismatchSnafu {}
SegmentFileIdentifierMismatchSnafu,
);
Ok(())