Clarify an unreachable unwrap

This commit is contained in:
Clément Renault 2023-11-28 14:26:31 +01:00
parent 1575456594
commit 7dd1226faf
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -54,6 +54,7 @@ impl<'a> heed::BytesDecode<'a> for StrBEU16Codec {
}
let (word_plus_nul_byte, bytes) = bytes.split_at(bytes.len() - footer_len);
// unwrap: we just checked the footer + 1 above.
let (_, word) = word_plus_nul_byte.split_last().unwrap();
let word = str::from_utf8(word)?;
let pos = bytes.try_into().map(u16::from_be_bytes)?;