Don't use ok_or_else for a copy value (#778)

Needed to fix today's clippy linting error

- [x]  no changelog update needed
This commit is contained in:
Gwilym Inzani 2024-10-02 17:03:53 +01:00 committed by GitHub
commit bfe3a02a50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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];