Use the external constant value MAGIC.

This commit is contained in:
2024-07-02 13:16:28 -05:00
parent 0a43a8b9f7
commit 6a5e2b3ab9

View File

@@ -5,10 +5,9 @@ use crate::{
};
pub fn try_read_magic<I: Iterator<Item=u8>>(bytes: &mut I) -> Result<(), DecodeError> {
let magic: [u8; 4] = [b'q', b'o', b'i', b'f'];
for i in 0..4 {
if let Some(letter) = bytes.next() {
if letter != magic[i] {
if letter != MAGIC[i] {
return Err(DecodeError::Magic)
}
} else {