Don't use ok_or_else for a copy value

This commit is contained in:
Gwilym Inzani 2024-10-02 16:56:12 +01:00
parent 93dabdb8ca
commit b7250f45e5

View file

@ -27,7 +27,7 @@ pub fn load_dwarf(file_content: &[u8]) -> Result<GimliDwarf, LoadDwarfError> {
let last_non_zero_byte = file_content
.iter()
.rposition(|&b| b != 0)
.ok_or_else(|| LoadDwarfError::GbaFileEmpty)?;
.ok_or(LoadDwarfError::GbaFileEmpty)?;
let file_content = &file_content[..last_non_zero_byte + 1];