diff --git a/src/mimedb.rs b/src/mimedb.rs index abaf476..2ee86ed 100644 --- a/src/mimedb.rs +++ b/src/mimedb.rs @@ -30,8 +30,8 @@ impl MimeDb for InferDb { // and then there's some other stuff we don't care about right now // so, here comes our fancy pants """""SGML-ish validator""""" - for i in 0..buf.len() { - match buf[i] { + for c in buf { + match c { // whitespace (according to https://www.w3.org/TR/xml/#NT-S) b'\t' | b'\r' | b'\n' | b'\x20' => continue, b'<' => break, @@ -43,10 +43,10 @@ impl MimeDb for InferDb { // - split the buffer up into chunks separated by the less than sign // - check to see if this chunk starts with any of these identifiers: let identifiers: Vec<&[u8]> = vec![ - "svg".as_bytes(), - "SVG".as_bytes(), - "!DOCTYPE svg".as_bytes(), - "!DOCTYPE SVG".as_bytes() + b"svg", + b"SVG", + b"!DOCTYPE svg", + b"!DOCTYPE SVG" ]; // - if it does, the nested `any` will short circuit and immediately return true, causing the parent `any` to do // the same