fix: remove impossible failure case

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

View File

@ -559,12 +559,12 @@ async fn is_segment_stream(f: &mut Pin<Box<dyn AsyncRead>>) -> Result<()> {
const UUID_BYTES_LEN: usize = 16;
async fn read_id(f: &mut Pin<Box<dyn AsyncRead>>) -> Result<SegmentId> {
let mut id_header = vec![0u8; UUID_BYTES_LEN];
let mut id_header = [0u8; UUID_BYTES_LEN];
f.read_exact(&mut id_header)
.await
.context(UnableToReadSegmentIdSnafu)?;
let uuid = Uuid::from_slice(&id_header).expect("uuid bytes length should always be 16");
let uuid = Uuid::from_bytes(id_header);
Ok(SegmentId::from(uuid))
}