diff options
Diffstat (limited to 'support/pkgcheck/src/filemagic.rs')
-rw-r--r-- | support/pkgcheck/src/filemagic.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/support/pkgcheck/src/filemagic.rs b/support/pkgcheck/src/filemagic.rs index f3a4bcc391..0785664c46 100644 --- a/support/pkgcheck/src/filemagic.rs +++ b/support/pkgcheck/src/filemagic.rs @@ -19,7 +19,7 @@ use unicode_bom::Bom; // - https://filesignatures.net/ // - https://github.com/7h3rAm/cigma/blob/master/cigma/magicbytes.json -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum LineEnding { Lf, Cr, @@ -27,7 +27,7 @@ pub enum LineEnding { Mixed(usize, usize, usize), } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum Mimetype { Binary, Script(LineEnding), @@ -264,7 +264,7 @@ impl Filetype { // https://en.wikipedia.org/wiki/Executable_and_Linkable_Format fn is_binary(vec: &[u8]) -> Option<Mimetype> { - let binary_re: RegexSet = RegexSet::new(&[ + let binary_re: RegexSet = RegexSet::new([ r"^(?-u)\x7FELF[\x01\x02][\x01\x02]\x01[\x00-\x11]", // Executable and Linkable Format (ELF) r"^(?-u)\x00\x00\x03\xF3", // AmigaOS loadseg()ble executable/binary r"^(?-u)MZ", // DOS MZ executable file format and its descendants (including NE and PE) @@ -288,7 +288,7 @@ fn is_archive(vec: &[u8]) -> Option<Mimetype> { // - opendocument formats // - Word Open XML // Those we do not regard as archives - let special_zip: RegexSet = RegexSet::new(&[ + let special_zip: RegexSet = RegexSet::new([ r"^(?-u)PK\x03\x04.{20,}\x08\x00\x00\x00mimetypeapplication", r"^(?-u)PK\x03\x04\x14\x00\x06\x00", // Word Open XML (.docx) r"^(?-u)PK\x03\x04\x14\x00\x08\x00", // Java Jar file @@ -303,7 +303,7 @@ fn is_archive(vec: &[u8]) -> Option<Mimetype> { return Some(Mimetype::Data); } - let archive_re: RegexSet = RegexSet::new(&[ + let archive_re: RegexSet = RegexSet::new([ r"^(?-u)\x37\x7A\xBC\xAF\x27\x1C", // 7zip r"^(?-u)\x1f\x8B", // gzip (.gz) r"^(?-u)\x1f\x9D", // LZW (.tar.Z) @@ -332,7 +332,7 @@ fn is_archive(vec: &[u8]) -> Option<Mimetype> { return Some(Mimetype::Archive); } - let archive_re: RegexSet = RegexSet::new(&[ + let archive_re: RegexSet = RegexSet::new([ r"^(?-u)PK(\x03\x04|\x4c\x49\x54\x45|\x30\x30\x50|\x05\x06|\x07\x08)", // zip archive ]) .unwrap(); |