diff --git a/Cargo.lock b/Cargo.lock index d3d007d8..07b7acf2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,15 +4,15 @@ version = "0.15.1" dependencies = [ "bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.20.5 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy 0.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.23.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.129 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "zopfli 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -29,7 +29,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "aho-corasick" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -40,6 +40,16 @@ name = "ansi_term" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "atty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bit-vec" version = "0.4.3" @@ -50,6 +60,11 @@ name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bitflags" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "0.5.3" @@ -65,38 +80,38 @@ name = "cargo_metadata" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clap" -version = "2.20.5" +version = "2.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clippy" -version = "0.0.118" +version = "0.0.129" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cargo_metadata 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy_lints 0.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy_lints 0.0.129 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clippy_lints" -version = "0.0.118" +version = "0.0.129" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -112,12 +127,12 @@ name = "crc" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "deflate" -version = "0.7.5" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -126,11 +141,8 @@ dependencies = [ [[package]] name = "deque" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "dtoa" @@ -139,7 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "either" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -150,9 +162,14 @@ dependencies = [ "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "futures" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "gcc" -version = "0.3.43" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -175,10 +192,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "itertools" -version = "0.5.9" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "either 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -197,12 +214,12 @@ dependencies = [ [[package]] name = "lazy_static" -version = "0.2.4" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -215,7 +232,7 @@ name = "memchr" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -223,13 +240,13 @@ name = "miniz-sys" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-integer" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", @@ -240,7 +257,7 @@ name = "num-iter" version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -249,7 +266,7 @@ name = "num-rational" version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -260,10 +277,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num_cpus" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -272,7 +289,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "deflate 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", + "deflate 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", "inflate 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -292,17 +309,27 @@ name = "rand" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon-core" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "deque 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -311,7 +338,7 @@ name = "regex" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "simd 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -326,7 +353,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-serialize" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -344,36 +371,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "0.9.11" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_codegen_internals" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "0.9.11" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_codegen_internals 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen_internals 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -388,7 +415,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.11.9" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -406,11 +433,11 @@ dependencies = [ [[package]] name = "term_size" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -420,7 +447,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -437,7 +464,7 @@ name = "toml" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -475,7 +502,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "vec_map" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -506,57 +533,61 @@ dependencies = [ [metadata] "checksum adler32 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e928aa58f6dbd754bda26eca562a242549cb606e27a2240fc305fc75a7f12af9" "checksum adler32 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ff33fe13a08dbce05bcefa2c68eea4844941437e33d6f808240b54d7157b9cd" -"checksum aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0638fd549427caa90c499814196d1b9e3725eb4d15d7339d6de073a680ed0ca2" +"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" +"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159" "checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" +"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" "checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" "checksum cargo_metadata 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "34fdab49a2904acb112c83b62f0118de3de3ce28e52a9188dec2858e43878f25" -"checksum clap 2.20.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7db281b0520e97fbd15cd615dcd8f8bcad0c26f5f7d5effe705f090f39e9a758" -"checksum clippy 0.0.118 (registry+https://github.com/rust-lang/crates.io-index)" = "6cb0894ce1af2464033706bf9b33e28c4a8fc72df8449fcd60f7a5162a7a9630" -"checksum clippy_lints 0.0.118 (registry+https://github.com/rust-lang/crates.io-index)" = "67d4bf7c7bb21b11b4d62146bcc8abaaf4e230a6346a21c9e88fa0c3540c71a4" +"checksum clap 2.23.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f57e9b63057a545ad2ecd773ea61e49422ed1b1d63d74d5da5ecaee55b3396cd" +"checksum clippy 0.0.129 (registry+https://github.com/rust-lang/crates.io-index)" = "20faf5c612c7843d05090a1e015c8e7d6fbf04653846daed3b7d0d34dad7e752" +"checksum clippy_lints 0.0.129 (registry+https://github.com/rust-lang/crates.io-index)" = "706babc662d6ac2ddc8683cc3f7c0a160ff8a53ac5eef8aca52aa34dae051561" "checksum crc 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc1914fae6f18ae347320f0ba5e4fc270e17c037ea621fe41ec7e8adf67d11b0" -"checksum deflate 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebb02aaf4b775afc96684b8402510a338086974e38570a1f65bea8c202eb77a7" -"checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf" +"checksum deflate 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "464225978f3f01068194aa948852ec121d179c3f874d499d74c432953bf1917b" +"checksum deque 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a694dae478589798d752c7125542f8a5ae8b6e59476172baf2eed67357bdfa27" "checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90" -"checksum either 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "63f94a35a9ca0d4178e85f0250373f2cea55c5d603e6993778d68a99b3d8071c" +"checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a" "checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" -"checksum gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d" +"checksum futures 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "55f0008e13fc853f79ea8fc86e931486860d4c4c156cdffb59fa5f7fa833660a" +"checksum gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "40899336fb50db0c78710f53e87afc54d8c7266fb76262fecc78ca1a7f09deae" "checksum image 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c3f4f5ea213ed9899eca760a8a14091d4b82d33e27cf8ced336ff730e9f6da8" "checksum inflate 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d1238524675af3938a7c74980899535854b88ba07907bb1c944abe5b8fc437e5" -"checksum itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d95557e7ba6b71377b0f2c3b3ae96c53f1b75a926a6901a500f557a370af730a" +"checksum itertools 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "772a0928a97246167d59a2a4729df5871f1327ab8b36fd24c4224b229cb47b99" "checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7291b1dd97d331f752620b02dfdbc231df7fc01bf282a00769e1cdb963c460dc" -"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135" +"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" +"checksum libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "babb8281da88cba992fa1f4ddec7d63ed96280a1a53ec9b919fd37b53d71e502" "checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" "checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" "checksum miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "28eaee17666671fa872e567547e8428e83308ebe5808cdf6a0e28397dbe2c726" -"checksum num-integer 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "21e4df1098d1d797d27ef0c69c178c3fab64941559b290fcae198e0825c9c8b5" +"checksum num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1a4bf6f9174aa5783a9b4cc892cacd11aebad6c69ad027a0b65c6ca5f8aa37" "checksum num-iter 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d1891bd7b936f12349b7d1403761c8a0b85a18b148e9da4429d5d102c1a41e" "checksum num-rational 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "c2dc5ea04020a8f18318ae485c751f8cfa1c0e69dcf465c29ddaaa64a313cc44" "checksum num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "e1cbfa3781f3fe73dc05321bed52a06d2d491eaa764c52335cf4399f046ece99" -"checksum num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a18c392466409c50b87369414a2680c93e739aedeb498eb2bff7d7eb569744e2" +"checksum num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca313f1862c7ec3e0dfe8ace9fa91b1d9cb5c84ace3d00f5ec4216238e93c167" "checksum png 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48f397b84083c2753ba53c7b56ad023edb94512b2885ffe227c66ff7edb61868" "checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" -"checksum rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50c575b58c2b109e2fbc181820cbe177474f35610ff9e357dc75f6bac854ffbf" +"checksum rayon 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8c83adcb08e5b922e804fe1918142b422602ef11f2fd670b0b52218cb5984a20" +"checksum rayon-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "767d91bacddf07d442fe39257bf04fd95897d1c47c545d009f6beb03efd038f8" "checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01" "checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457" -"checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "a702319c807c016e51f672e5c77d6f0b46afddd744b5e437d6b8436b888b458f" -"checksum serde_codegen_internals 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d52006899f910528a10631e5b727973fe668f3228109d1707ccf5bad5490b6e" -"checksum serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f15ea24bd037b2d64646b4d934fa99c649be66e3f7b29fb595a5543b212b1452" -"checksum serde_json 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "dbc45439552eb8fb86907a2c41c1fd0ef97458efb87ff7f878db466eb581824e" +"checksum serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "34b623917345a631dc9608d5194cc206b3fe6c3554cd1c75b937e55e285254af" +"checksum serde_codegen_internals 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc888bd283bd2420b16ad0d860e35ad8acb21941180a83a189bb2046f9d00400" +"checksum serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)" = "978fd866f4d4872084a81ccc35e275158351d3b9fe620074e7d7504b816b74ba" +"checksum serde_json 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ad8bcf487be7d2e15d3d543f04312de991d631cfe1b43ea0ade69e6a8a5b16a1" "checksum simd 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5847c2d766ca7ce7227672850955802fabd779ba616aeabead4c2c3877023" "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" -"checksum syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)" = "480c834701caba3548aa991e54677281be3a5414a9d09ddbdf4ed74a569a9d19" +"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a" +"checksum term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b6b55df3198cc93372e85dd2ed817f0e38ce8cc0f22eb32391bfad9c4bf209" "checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a" "checksum thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" @@ -566,7 +597,7 @@ dependencies = [ "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" -"checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f" +"checksum vec_map 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8cdc8b93bd0198ed872357fb2e667f7125646b1762f16d60b2c96350d361897" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/Cargo.toml b/Cargo.toml index 1969b4a4..18e9abf1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,11 +23,11 @@ path = "src/main.rs" bit-vec = "^0.4.2" byteorder = "^1.0.0" crc = "^1.2.0" -itertools = "^0.5.7" +itertools = "^0.6.0" libc = "^0.2.4" miniz-sys = "^0.1.7" num_cpus = "^1.0.0" -rayon = "^0.6.0" +rayon = "^0.7.0" zopfli = "^0.3.4" [dependencies.clap] diff --git a/src/filters.rs b/src/filters.rs index fb12b7de..cb84d279 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -15,9 +15,9 @@ pub fn filter_line(filter: u8, bpp: usize, data: &[u8], last_line: &[u8]) -> Vec if last_line.is_empty() { filtered.extend_from_slice(data); } else { - filtered.extend(data.iter().zip(last_line.iter()).map(|(cur, last)| { - cur.wrapping_sub(*last) - })); + filtered.extend(data.iter() + .zip(last_line.iter()) + .map(|(cur, last)| cur.wrapping_sub(*last))); }; } 3 => { @@ -87,9 +87,9 @@ pub fn unfilter_line(filter: u8, bpp: usize, data: &[u8], last_line: &[u8]) -> V if last_line.is_empty() { unfiltered.extend_from_slice(data); } else { - unfiltered.extend(data.iter().zip(last_line.iter()).map(|(cur, last)| { - cur.wrapping_add(*last) - })); + unfiltered.extend(data.iter() + .zip(last_line.iter()) + .map(|(cur, last)| cur.wrapping_add(*last))); }; } 3 => { diff --git a/src/headers.rs b/src/headers.rs index 3225d086..9fac8b41 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -47,7 +47,8 @@ pub fn parse_next_header(byte_data: &[u8], byte_offset: &mut usize, fix_errors: bool) -> Result)>, PngError> { - let mut rdr = Cursor::new(byte_data.iter() + let mut rdr = Cursor::new(byte_data + .iter() .skip(*byte_offset) .take(4) .cloned() @@ -58,7 +59,8 @@ pub fn parse_next_header(byte_data: &[u8], }; *byte_offset += 4; - let mut header_bytes: Vec = byte_data.iter() + let mut header_bytes: Vec = byte_data + .iter() .skip(*byte_offset) .take(4) .cloned() @@ -73,13 +75,15 @@ pub fn parse_next_header(byte_data: &[u8], } *byte_offset += 4; - let data: Vec = byte_data.iter() + let data: Vec = byte_data + .iter() .skip(*byte_offset) .take(length as usize) .cloned() .collect(); *byte_offset += length as usize; - let mut rdr = Cursor::new(byte_data.iter() + let mut rdr = Cursor::new(byte_data + .iter() .skip(*byte_offset) .take(4) .cloned() diff --git a/src/lib.rs b/src/lib.rs index abf8e467..add444d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -281,7 +281,7 @@ impl Default for Options { pub fn optimize(filepath: &Path, opts: &Options) -> Result<(), PngError> { // Initialize the thread pool with correct number of threads let thread_count = opts.threads; - rayon::initialize(rayon::Configuration::new().set_num_threads(thread_count)).ok(); + rayon::initialize(rayon::Configuration::new().num_threads(thread_count)).ok(); // Read in the file and try to decode as PNG. if opts.verbosity.is_some() { @@ -308,7 +308,8 @@ pub fn optimize(filepath: &Path, opts: &Options) -> Result<(), PngError> { if opts.backup { match copy(in_file, in_file.with_extension(format!("bak.{}", - in_file.extension() + in_file + .extension() .unwrap() .to_str() .unwrap()))) { @@ -399,7 +400,7 @@ pub fn optimize(filepath: &Path, opts: &Options) -> Result<(), PngError> { pub fn optimize_from_memory(data: &[u8], opts: &Options) -> Result, PngError> { // Initialize the thread pool with correct number of threads let thread_count = opts.threads; - rayon::initialize(rayon::Configuration::new().set_num_threads(thread_count)).ok(); + rayon::initialize(rayon::Configuration::new().num_threads(thread_count)).ok(); // Read in the file and try to decode as PNG. if opts.verbosity.is_some() { @@ -461,7 +462,7 @@ fn optimize_png(png: &mut PngData, .ok(); } - let mut filter = opts.filter.clone(); + let mut filter = opts.filter.iter().cloned().collect::>(); let compression = &opts.compression; let memory = &opts.memory; let mut strategies = opts.strategies.clone(); @@ -471,14 +472,14 @@ fn optimize_png(png: &mut PngData, if png.ihdr_data.bit_depth.as_u8() >= 8 && png.ihdr_data.color_type != colors::ColorType::Indexed { if filter.is_empty() { - filter.insert(5); + filter.push(5); } if strategies.is_empty() { strategies.insert(1); } } else { if filter.is_empty() { - filter.insert(0); + filter.push(0); } if strategies.is_empty() { strategies.insert(0); @@ -516,8 +517,9 @@ fn optimize_png(png: &mut PngData, } let mut filters_tmp: Vec<(u8, Vec)> = Vec::with_capacity(filter.len()); - filter.par_iter() - .weight_max() + filter + .par_iter() + .with_max_len(1) .map(|f| (*f, png.filter_image(*f))) .collect_into(&mut filters_tmp); @@ -527,8 +529,9 @@ fn optimize_png(png: &mut PngData, let added_interlacing = opts.interlace == Some(1) && original_png.ihdr_data.interlaced == 0; let best: Option = - results.into_par_iter() - .weight_max() + results + .into_par_iter() + .with_max_len(1) .filter_map(|trial| { let filtered = &filters[&trial.0]; let new_idat = if opts.deflate == Deflaters::Zlib { @@ -617,8 +620,14 @@ fn optimize_png(png: &mut PngData, if let Ok(new_png) = new_png { if let Ok(old_png) = old_png { - if old_png.pixels().map(|x| x.2.channels().to_owned()).collect::>>() == - new_png.pixels().map(|x| x.2.channels().to_owned()).collect::>>() { + if old_png + .pixels() + .map(|x| x.2.channels().to_owned()) + .collect::>>() == + new_png + .pixels() + .map(|x| x.2.channels().to_owned()) + .collect::>>() { return Ok(output); } } else { diff --git a/src/main.rs b/src/main.rs index af05dbcb..2a83d750 100644 --- a/src/main.rs +++ b/src/main.rs @@ -227,7 +227,8 @@ fn main() { } }; - handle_optimization(matches.values_of("files") + handle_optimization(matches + .values_of("files") .unwrap() .map(PathBuf::from) .collect(), @@ -239,7 +240,8 @@ fn handle_optimization(inputs: Vec, opts: &Options) { let mut current_opts = opts.clone(); if input.is_dir() { if current_opts.recursive { - handle_optimization(input.read_dir() + handle_optimization(input + .read_dir() .unwrap() .map(|x| x.unwrap().path()) .collect(), @@ -391,7 +393,9 @@ fn parse_opts_into_struct(matches: &ArgMatches) -> Result { } if let Some(hdrs) = matches.value_of("strip") { - let hdrs = hdrs.split(',').map(|x| x.trim().to_owned()).collect::>(); + let hdrs = hdrs.split(',') + .map(|x| x.trim().to_owned()) + .collect::>(); if hdrs.contains(&"safe".to_owned()) || hdrs.contains(&"all".to_owned()) { if hdrs.len() > 1 { return Err("'safe' or 'all' presets for --strip should be used by themselves" diff --git a/src/png.rs b/src/png.rs index d2eabb9b..6cd09349 100644 --- a/src/png.rs +++ b/src/png.rs @@ -50,10 +50,7 @@ impl<'a> Iterator for ScanLines<'a> { pass.1 = 0; } } - let bits_per_pixel = self.png - .ihdr_data - .bit_depth - .as_u8() as u32 * + let bits_per_pixel = self.png.ihdr_data.bit_depth.as_u8() as u32 * self.png.channels_per_pixel() as u32; let y_steps; let pixels_factor; @@ -139,10 +136,7 @@ impl<'a> Iterator for ScanLines<'a> { } else { // Standard, non-interlaced PNG scanlines let bits_per_line = self.png.ihdr_data.width as usize * - self.png - .ihdr_data - .bit_depth - .as_u8() as usize * + self.png.ihdr_data.bit_depth.as_u8() as usize * self.png.channels_per_pixel() as usize; let bytes_per_line = (bits_per_line as f32 / 8f32).ceil() as usize; self.start = self.end; @@ -214,10 +208,7 @@ impl PngData { pub fn from_slice(byte_data: &[u8], fix_errors: bool) -> Result { let mut byte_offset: usize = 0; // Test that png header is valid - let header: Vec = byte_data.iter() - .take(8) - .cloned() - .collect(); + let header: Vec = byte_data.iter().take(8).cloned().collect(); if !file_header_is_valid(header.as_ref()) { return Err(PngError::new("Invalid PNG header detected")); } @@ -316,20 +307,25 @@ impl PngData { let mut output = vec![0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]; // IHDR let mut ihdr_data = Vec::with_capacity(13); - ihdr_data.write_u32::(self.ihdr_data.width).ok(); - ihdr_data.write_u32::(self.ihdr_data.height).ok(); + ihdr_data + .write_u32::(self.ihdr_data.width) + .ok(); + ihdr_data + .write_u32::(self.ihdr_data.height) + .ok(); ihdr_data.write_u8(self.ihdr_data.bit_depth.as_u8()).ok(); - ihdr_data.write_u8(self.ihdr_data.color_type.png_header_code()).ok(); + ihdr_data + .write_u8(self.ihdr_data.color_type.png_header_code()) + .ok(); ihdr_data.write_u8(0).ok(); // Compression -- deflate ihdr_data.write_u8(0).ok(); // Filter method -- 5-way adaptive filtering ihdr_data.write_u8(self.ihdr_data.interlaced).ok(); write_png_block(b"IHDR", &ihdr_data, &mut output); // Ancillary headers - for (key, header) in self.aux_headers.iter().filter(|&(key, _)| { - !(*key == "bKGD" || - *key == "hIST" || - *key == "tRNS") - }) { + for (key, header) in + self.aux_headers + .iter() + .filter(|&(key, _)| !(*key == "bKGD" || *key == "hIST" || *key == "tRNS")) { write_png_block(key.as_bytes(), header, &mut output); } // Palette @@ -344,10 +340,10 @@ impl PngData { write_png_block(b"tRNS", transparency_pixel, &mut output); } // Special ancillary headers that need to come after PLTE but before IDAT - for (key, header) in self.aux_headers.iter().filter(|&(key, _)| { - *key == "bKGD" || *key == "hIST" || - *key == "tRNS" - }) { + for (key, header) in + self.aux_headers + .iter() + .filter(|&(key, _)| *key == "bKGD" || *key == "hIST" || *key == "tRNS") { write_png_block(key.as_bytes(), header, &mut output); } // IDAT data @@ -423,9 +419,12 @@ impl PngData { for filter in if last_pass == line.pass { 0..5 } else { 0..2 } { trials.insert(filter, filter_line(filter, bpp, &line.data, &last_line)); } - let (best_filter, best_line) = trials.iter() + let (best_filter, best_line) = trials + .iter() .min_by_key(|x| { - x.1.iter().fold(0u64, |acc, &x| { + x.1 + .iter() + .fold(0u64, |acc, &x| { let signed = x as i8; acc + (signed as i16).abs() as u64 }) @@ -511,12 +510,12 @@ impl PngData { } else { self.palette.clone().unwrap() }; - let mut indexed_palette: Vec<&[u8]> = palette.chunks(if self.transparency_palette - .is_some() { - 4 - } else { - 3 - }) + let mut indexed_palette: Vec<&[u8]> = palette + .chunks(if self.transparency_palette.is_some() { + 4 + } else { + 3 + }) .collect(); // A map of old indexes to new ones, for any moved let mut index_map: HashMap = HashMap::new(); @@ -590,8 +589,9 @@ impl PngData { } } - let unused: Vec = - (0..indexed_palette.len() as u8).filter(|i| !seen.contains(i)).collect(); + let unused: Vec = (0..indexed_palette.len() as u8) + .filter(|i| !seen.contains(i)) + .collect(); // Remove unused palette indices self.do_palette_reduction(&unused, &mut index_map, &mut indexed_palette); @@ -690,7 +690,8 @@ impl PngData { } index_map.clear(); self.raw_data = new_data; - let new_palette = indexed_palette.iter() + let new_palette = indexed_palette + .iter() .cloned() .flatten() .enumerate() @@ -765,7 +766,9 @@ fn write_png_block(key: &[u8], header: &[u8], output: &mut Vec) { header_data.extend_from_slice(key); header_data.extend_from_slice(header); output.reserve(header_data.len() + 8); - output.write_u32::(header_data.len() as u32 - 4).ok(); + output + .write_u32::(header_data.len() as u32 - 4) + .ok(); let crc = crc32::checksum_ieee(&header_data); output.append(&mut header_data); output.write_u32::(crc).ok(); diff --git a/src/reduction.rs b/src/reduction.rs index 985faeb6..8ac3b80c 100644 --- a/src/reduction.rs +++ b/src/reduction.rs @@ -160,12 +160,15 @@ pub fn reduce_rgba_to_palette(png: &mut PngData) -> bool { if let Some(bkgd_header) = png.aux_headers.get_mut(&"bKGD".to_string()) { assert_eq!(bkgd_header.len(), 6); - let header_pixels = bkgd_header.iter() + let header_pixels = bkgd_header + .iter() .skip(1) .step(2) .cloned() .collect::>(); - if let Some(entry) = color_palette.chunks(3).position(|x| x == header_pixels.as_slice()) { + if let Some(entry) = color_palette + .chunks(3) + .position(|x| x == header_pixels.as_slice()) { *bkgd_header = vec![entry as u8]; } else if color_palette.len() / 3 == 256 { return false; @@ -235,12 +238,15 @@ pub fn reduce_rgb_to_palette(png: &mut PngData) -> bool { if let Some(bkgd_header) = png.aux_headers.get_mut(&"bKGD".to_string()) { assert_eq!(bkgd_header.len(), 6); - let header_pixels = bkgd_header.iter() + let header_pixels = bkgd_header + .iter() .skip(1) .step(2) .cloned() .collect::>(); - if let Some(entry) = color_palette.chunks(3).position(|x| x == header_pixels.as_slice()) { + if let Some(entry) = color_palette + .chunks(3) + .position(|x| x == header_pixels.as_slice()) { *bkgd_header = vec![entry as u8]; } else if color_palette.len() == 255 { return false; @@ -273,13 +279,11 @@ pub fn reduce_rgb_to_grayscale(png: &mut PngData) -> bool { } reduced.push(cur_pixel[0]); } else { - let pixel_bytes = cur_pixel.iter() + let pixel_bytes = cur_pixel + .iter() .step(2) .cloned() - .zip(cur_pixel.iter() - .skip(1) - .step(2) - .cloned()) + .zip(cur_pixel.iter().skip(1).step(2).cloned()) .unique() .collect::>(); if pixel_bytes.len() > 1 {