Use the external constant value MAGIC.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user