diff --git a/CHANGELOG.md b/CHANGELOG.md index 2759907..266d621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ - -## 0.1.4 (2019-11-03) +# Change Log +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + +## [Unreleased] - ReleaseDate + +## 0.1.4 - 2019-11-03 #### Bug Fixes @@ -17,5 +25,5 @@ * Use standard identifier rules to avoid doing umber checks ([107308a6](https://github.com/crate-ci/typos/commit/107308a655a425eb593bf5e4928572c16e6a9bdd)) * Only do hex check if digits are in identifiers ([68cd36d0](https://github.com/crate-ci/typos/commit/68cd36d0de90226dbc9d31c2ce6d8bf6b69adb5c)) - - + +[Unreleased]: https://github.com/assert-rs/predicates-rs/compare/v0.1.4...HEAD diff --git a/Cargo.lock b/Cargo.lock index 0f0d1fb..1a68dba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,12 +17,12 @@ checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" [[package]] name = "ahash" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75b7e6a93ecd6dbd2c225154d0fa7f86205574ecaa6c87429fb5f66ee677c44" +checksum = "efa60d2eadd8b12a996add391db32bd1153eac697ba4869660c0016353611426" dependencies = [ - "getrandom 0.2.1", - "lazy_static", + "getrandom 0.2.2", + "once_cell", "version_check", ] @@ -58,9 +58,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "assert_fs" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dabd011e19821a348abb0dec7b7fda959cd6b3477c474395b958b291942b0e" +checksum = "3203d5bb9979ac7210f01a150578ebafef6f08b55e79f6db32673c0977b94340" dependencies = [ "doc-comment", "globwalk", @@ -89,9 +89,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598" +checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" dependencies = [ "addr2line", "cfg-if 1.0.0", @@ -131,12 +131,27 @@ dependencies = [ "serde", ] +[[package]] +name = "bumpalo" +version = "3.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" + [[package]] name = "byteorder" version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" +[[package]] +name = "cast" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +dependencies = [ + "rustc_version", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -191,7 +206,7 @@ name = "codespell-codegen" version = "0.1.2" dependencies = [ "codegenrs", - "itertools", + "itertools 0.10.0", "phf", "phf_codegen", "structopt", @@ -207,6 +222,12 @@ dependencies = [ "unicase", ] +[[package]] +name = "const_fn" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" + [[package]] name = "content_inspector" version = "0.2.4" @@ -216,6 +237,77 @@ dependencies = [ "memchr", ] +[[package]] +name = "criterion" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" +dependencies = [ + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.10.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" +dependencies = [ + "cast", + "itertools 0.9.0", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" +dependencies = [ + "cfg-if 1.0.0", + "const_fn", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", +] + [[package]] name = "crossbeam-utils" version = "0.8.1" @@ -270,7 +362,7 @@ dependencies = [ "proc-macro2 1.0.24", "quote 1.0.8", "strsim 0.9.3", - "syn 1.0.57", + "syn 1.0.60", ] [[package]] @@ -281,7 +373,7 @@ checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ "darling_core", "quote 1.0.8", - "syn 1.0.57", + "syn 1.0.60", ] [[package]] @@ -306,19 +398,19 @@ checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.8", - "syn 1.0.57", + "syn 1.0.60", ] [[package]] name = "derive_setters" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6604612c19dd3bb353650b715b61f09bcb089dd17bdca1a9a42637079bf5e428" +checksum = "f1cf41b4580a37cca5ef2ada2cc43cf5d6be3983f4522e83010d67ab6925e84b" dependencies = [ "darling", "proc-macro2 1.0.24", "quote 1.0.8", - "syn 1.0.57", + "syn 1.0.60", ] [[package]] @@ -432,7 +524,7 @@ checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.8", - "syn 1.0.57", + "syn 1.0.60", ] [[package]] @@ -455,7 +547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" dependencies = [ "atty", - "humantime 2.0.1", + "humantime 2.1.0", "log", "regex", "termcolor", @@ -495,13 +587,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.1+wasi-snapshot-preview1", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] @@ -525,14 +617,21 @@ dependencies = [ [[package]] name = "globwalk" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9db17aec586697a93219b19726b5b68307eba92898c34b170857343fe67c99d" +checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" dependencies = [ + "bitflags", "ignore", "walkdir", ] +[[package]] +name = "half" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" + [[package]] name = "heck" version = "0.3.2" @@ -544,9 +643,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -577,9 +676,9 @@ dependencies = [ [[package]] name = "humantime" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "ident_case" @@ -605,6 +704,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.10.0" @@ -620,6 +728,15 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +[[package]] +name = "js-sys" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -641,17 +758,17 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.82" +version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] @@ -660,6 +777,15 @@ version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +[[package]] +name = "memoffset" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +dependencies = [ + "autocfg", +] + [[package]] name = "miniz_oxide" version = "0.4.3" @@ -675,7 +801,7 @@ name = "misspell-codegen" version = "0.1.2" dependencies = [ "codegenrs", - "itertools", + "itertools 0.10.0", "phf", "phf_codegen", "regex", @@ -694,9 +820,9 @@ dependencies = [ [[package]] name = "nom" -version = "6.0.1" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88034cfd6b4a0d54dd14f4a507eceee36c0b70e5a02236c4e4df571102be17f0" +checksum = "ab6f70b46d6325aa300f1c7bb3d470127dfc27806d8ea6bf294ee0ce643ce2b1" dependencies = [ "bitvec", "lexical-core", @@ -720,10 +846,20 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.22.0" +name = "num_cpus" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" [[package]] name = "once_cell" @@ -731,6 +867,12 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "os_type" version = "2.2.0" @@ -766,7 +908,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ "phf_shared", - "rand", + "rand 0.7.3", ] [[package]] @@ -779,6 +921,34 @@ dependencies = [ "unicase", ] +[[package]] +name = "plotters" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" + +[[package]] +name = "plotters-svg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +dependencies = [ + "plotters-backend", +] + [[package]] name = "ppv-lite86" version = "0.2.10" @@ -787,9 +957,9 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "predicates" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73dd9b7b200044694dfede9edf907c1ca19630908443e9447e624993700c6932" +checksum = "eeb433456c1a57cc93554dea3ce40b4c19c4057e41c55d4a0f3d84ea71c325aa" dependencies = [ "difference", "float-cmp", @@ -800,15 +970,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3dbeaaf793584e29c58c7e3a82bbb3c7c06b63cea68d13b0e3cddc124104dc" +checksum = "57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451" [[package]] name = "predicates-tree" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aee95d988ee893cb35c06b148c80ed2cd52c8eea927f50ba7a0be1a786aeab73" +checksum = "15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2" dependencies = [ "predicates-core", "treeline", @@ -816,9 +986,9 @@ dependencies = [ [[package]] name = "proc-exit" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bf98af012a71ad9456b92fdba48c29d59f971610932cce8ef73a4daa7954501" +checksum = "d94a40d6d1c03eb98fdf7c983a6b550798e6e805afa46112c54aaaaeb48a276f" [[package]] name = "proc-macro-error" @@ -829,7 +999,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2 1.0.24", "quote 1.0.8", - "syn 1.0.57", + "syn 1.0.60", "version_check", ] @@ -900,12 +1070,24 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom 0.1.16", "libc", - "rand_chacha", - "rand_core", - "rand_hc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", "rand_pcg", ] +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.1", + "rand_hc 0.3.0", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -913,7 +1095,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.1", ] [[package]] @@ -925,13 +1117,31 @@ dependencies = [ "getrandom 0.1.16", ] +[[package]] +name = "rand_core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" +dependencies = [ + "getrandom 0.2.2", +] + [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.1", ] [[package]] @@ -940,14 +1150,42 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rayon" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.1.57" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +dependencies = [ + "bitflags", +] [[package]] name = "regex" @@ -1015,6 +1253,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + [[package]] name = "semver" version = "0.9.0" @@ -1032,22 +1276,32 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.118" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" dependencies = [ "serde_derive", ] [[package]] -name = "serde_derive" -version = "1.0.118" +name = "serde_cbor" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +dependencies = [ + "half", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.123" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.8", - "syn 1.0.57", + "syn 1.0.60", ] [[package]] @@ -1106,7 +1360,7 @@ dependencies = [ "proc-macro-error", "proc-macro2 1.0.24", "quote 1.0.8", - "syn 1.0.57", + "syn 1.0.60", ] [[package]] @@ -1122,9 +1376,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.57" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.8", @@ -1139,13 +1393,13 @@ checksum = "36474e732d1affd3a6ed582781b3683df3d0563714c59c39591e8ff707cf078e" [[package]] name = "tempfile" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "rand", + "rand 0.8.3", "redox_syscall", "remove_dir_all", "winapi", @@ -1186,16 +1440,26 @@ checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.8", - "syn 1.0.57", + "syn 1.0.60", ] [[package]] name = "thread_local" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" dependencies = [ - "lazy_static", + "once_cell", +] + +[[package]] +name = "tinytemplate" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2ada8616fad06a2d0c455adc530de4ef57605a8120cc65da9653e0e9623ca74" +dependencies = [ + "serde", + "serde_json", ] [[package]] @@ -1218,7 +1482,7 @@ name = "typos" version = "0.3.0" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.0", "log", "once_cell", "regex", @@ -1238,6 +1502,7 @@ dependencies = [ "clap", "clap-verbosity-flag", "content_inspector", + "criterion", "derive_more 0.99.11", "derive_setters", "difflib", @@ -1245,7 +1510,7 @@ dependencies = [ "env_logger 0.8.2", "human-panic", "ignore", - "itertools", + "itertools 0.10.0", "log", "phf", "predicates", @@ -1253,7 +1518,6 @@ dependencies = [ "serde", "serde_json", "structopt", - "syn 1.0.57", "toml", "typos", "typos-dict", @@ -1290,7 +1554,7 @@ dependencies = [ "codegenrs", "csv", "edit-distance", - "itertools", + "itertools 0.10.0", "structopt", "unicase", "varcon", @@ -1314,7 +1578,7 @@ dependencies = [ "clap-verbosity-flag", "codegenrs", "env_logger 0.7.1", - "itertools", + "itertools 0.10.0", "log", "phf", "phf_codegen", @@ -1364,7 +1628,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.1", + "getrandom 0.2.2", ] [[package]] @@ -1422,16 +1686,80 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.1+wasi-snapshot-preview1" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[package]] +name = "wasm-bindgen" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.60", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" +dependencies = [ + "quote 1.0.8", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.60", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" + +[[package]] +name = "web-sys" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" +dependencies = [ + "js-sys", + "wasm-bindgen", +] [[package]] name = "wikipedia-codegen" version = "0.1.1" dependencies = [ "codegenrs", - "itertools", + "itertools 0.10.0", "phf", "phf_codegen", "structopt", diff --git a/Cargo.toml b/Cargo.toml index 62edaed..07d574d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ toml = "0.5" log = "0.4" env_logger = "0.8" bstr = "0.2" -ahash = "0.6.1" +ahash = "0.7" difflib = "0.4" proc-exit = "1.0" human-panic = "1.0.3" @@ -57,16 +57,26 @@ derive_setters = "0.1" itertools = "0.10" serde_json = "1.0" encoding = "0.2" -# HACK: Force a syn version until everyone has fixed their reliance on internal -# APIs. -syn = "=1.0.57" [dev-dependencies] assert_fs = "1.0" predicates = "1.0" +criterion = "0.3" [profile.dev] panic = "abort" [profile.release] panic = "abort" + +[[bench]] +name = "checks" +harness = false + +[[bench]] +name = "corrections" +harness = false + +[[bench]] +name = "tokenize" +harness = false diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b8ed1fd..0d00182 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,6 +3,15 @@ trigger: include: ['master'] tags: include: ['v*'] +pr: + branches: + include: + - master + paths: + exclude: + - "*.md" + - "docs/*" + - "LICENSE-*" schedules: - cron: "3 3 3 * *" displayName: Monthly Build @@ -10,7 +19,7 @@ schedules: include: - master variables: - minrust: 1.47.0 + minrust: 1.49.0 codecov_token: $(CODECOV_TOKEN_SECRET) windows_vm: vs2017-win2016 mac_vm: macos-10.14 @@ -28,18 +37,9 @@ stages: - template: install-rust.yml@templates parameters: rust: stable - - script: cargo check --all --bins --examples --tests - displayName: Default features - - job: cargo_check_bench - displayName: cargo check --benches - pool: - vmImage: ${{ variables.linux_vm }} - continueOnError: true - steps: - - template: install-rust.yml@templates - parameters: - rust: nightly - - script: cargo check --all --benches + - script: cargo check --workspace --locked + displayName: Check that Cargo.lock is satisfiable + - script: cargo check --workspace --all-targets displayName: Default features - stage: test displayName: Test @@ -60,15 +60,25 @@ stages: imageName: ${{ variables.linux_vm }} target: 'x86_64-unknown-linux-gnu' channel: stable + # Check for upcoming platform-specific compiler breakages + windows_beta: + imageName: ${{ variables.windows_vm }} + target: 'x86_64-pc-windows-msvc' + channel: beta + mac_beta: + imageName: ${{ variables.mac_vm }} + target: 'x86_64-apple-darwin' + channel: beta linux_beta: imageName: ${{ variables.linux_vm }} target: 'x86_64-unknown-linux-gnu' channel: beta + # Check for compiler breakages linux_nightly: imageName: ${{ variables.linux_vm }} target: 'x86_64-unknown-linux-gnu' channel: nightly - continueOnError: ${{ eq(variables.channel, 'nightly') }} + continueOnError: $[ne(variables.channel, 'stable')] pool: vmImage: $(imageName) steps: @@ -76,9 +86,9 @@ stages: parameters: rust: $(channel) targets: ["$(TARGET)"] - - script: cargo test --target $(TARGET) --all + - script: cargo test --target $(TARGET) --workspace displayName: cargo test - - script: cargo doc --target $(TARGET) --no-deps --all + - script: cargo doc --target $(TARGET) --workspace --no-deps displayName: cargo doc - job: msrv displayName: "${{ format('Minimum supported Rust version: {0}', variables.minrust) }}" @@ -89,13 +99,14 @@ stages: - template: install-rust.yml@templates parameters: rust: ${{ variables.minrust }} - - script: cargo check --all + - script: cargo check --all --bins --examples --tests displayName: cargo check - stage: style displayName: Style checks dependsOn: [] jobs: - job: "Committed" + displayName: Linting commit history pool: vmImage: ${{ variables.linux_vm }} steps: @@ -106,19 +117,38 @@ stages: target: 'x86_64-unknown-linux-gnu' to: $(Build.StagingDirectory)/tools - script: | - echo "This project uses Conventional style, see https://www.conventionalcommits.org" + echo "Linting commits:" + git log --graph --oneline HEAD~..HEAD^2 + echo "Against 'committed.toml':" + $(Build.StagingDirectory)/tools/committed --dump-config - + echo "" + echo "If this fails, don't sweat it. We're trying to encourage clear communication and not hinder contributions." + echo "If it is a reasonable issue and you lack time or feel uncomfortable fixing it yourself," + echo "let us know and we can mentor or fix it." $(Build.StagingDirectory)/tools/committed HEAD~..HEAD^2 --no-merge-commit -vv - displayName: Committed + displayName: Lint commit history condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) - job: style - displayName: Style linting + displayName: Style checking + pool: + vmImage: ${{ variables.linux_vm }} + steps: + - template: install-rust.yml@templates + parameters: + rust: stable + components: + - rustfmt + - script: cargo fmt --all -- --check + displayName: rustfmt + - job: lint + displayName: Linting strategy: matrix: current: - channel: stable + channel: ${{ variables.minrust }} next: - channel: beta - continueOnError: ${{ eq(variables.channel, 'beta') }} + channel: stable + continueOnError: $[eq(variables.channel, 'stable')] pool: vmImage: ${{ variables.linux_vm }} steps: @@ -126,24 +156,21 @@ stages: parameters: rust: $(channel) components: - - rustfmt - clippy - - script: cargo fmt --all -- --check - displayName: rustfmt - - script: cargo check --all + - script: cargo check --workspace --all-targets --all-features displayName: Warnings env: RUSTFLAGS: "-D warnings" - - script: cargo clippy --all -- -D warnings + - script: cargo clippy --workspace --all-features --all-targets -- -D warnings displayName: clippy - ${{ if ne('', variables.codecov_token) }}: - stage: coverage displayName: Code coverage dependsOn: test jobs: - - template: coverage.yml@templates - parameters: - token: ${{ variables.codecov_token }} + - template: coverage.yml@templates + parameters: + token: ${{ variables.codecov_token }} - stage: codegen displayName: Verify Code-gen dependsOn: ["check"] @@ -174,8 +201,9 @@ stages: - script: | cargo run --package varcon-codegen -- --output crates/varcon/src/codegen.rs --check displayName: Verify varcon-dict -- stage: Release - dependsOn: test +- stage: release + displayName: Release + dependsOn: [] condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') jobs: - job: @@ -197,8 +225,11 @@ stages: vmImage: $(imageName) steps: - template: install-rust.yml@templates + parameters: + rust: stable + targets: ["$(TARGET)"] - script: | - cargo rustc --target $(TARGET) --release --bin $(CRATE_NAME) -- -C lto + cargo build --target $(TARGET) --release --bin $(CRATE_NAME) displayName: Build - task: CopyFiles@2 displayName: Stage assets diff --git a/benches/checks.rs b/benches/checks.rs index fbf1f42..2b311e8 100644 --- a/benches/checks.rs +++ b/benches/checks.rs @@ -1,212 +1,96 @@ -#![feature(test)] - -extern crate test; - mod data; use assert_fs::prelude::*; +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use typos_cli::checks::FileChecker; -fn bench_files(data: &str, b: &mut test::Bencher) { - let temp = assert_fs::TempDir::new().unwrap(); - let sample_path = temp.child("sample"); - sample_path.write_str(data).unwrap(); +fn bench_checks(c: &mut Criterion) { + let mut group = c.benchmark_group("checks"); + for (name, sample) in data::DATA { + let len = sample.len(); + group.bench_with_input(BenchmarkId::new("files", name), &len, |b, _| { + let temp = assert_fs::TempDir::new().unwrap(); + let sample_path = temp.child("sample"); + sample_path.write_str(sample).unwrap(); - let corrections = typos_cli::dict::BuiltIn::new(Default::default()); - let parser = typos::tokens::Tokenizer::new(); - let checks = typos_cli::checks::TyposSettings::new().build_files(); - b.iter(|| { - checks.check_file( - sample_path.path(), - true, - &parser, - &corrections, - &typos_cli::report::PrintSilent, - ) - }); + let corrections = typos_cli::dict::BuiltIn::new(Default::default()); + let parser = typos::tokens::Tokenizer::new(); + let checks = typos_cli::checks::TyposSettings::new().build_files(); + b.iter(|| { + checks.check_file( + sample_path.path(), + true, + &parser, + &corrections, + &typos_cli::report::PrintSilent, + ) + }); - temp.close().unwrap(); + temp.close().unwrap(); + }); + group.bench_with_input(BenchmarkId::new("identifiers", name), &len, |b, _| { + let temp = assert_fs::TempDir::new().unwrap(); + let sample_path = temp.child("sample"); + sample_path.write_str(sample).unwrap(); + + let corrections = typos_cli::dict::BuiltIn::new(Default::default()); + let parser = typos::tokens::Tokenizer::new(); + let checks = typos_cli::checks::TyposSettings::new().build_identifier_parser(); + b.iter(|| { + checks.check_file( + sample_path.path(), + true, + &parser, + &corrections, + &typos_cli::report::PrintSilent, + ) + }); + + temp.close().unwrap(); + }); + group.bench_with_input(BenchmarkId::new("words", name), &len, |b, _| { + let temp = assert_fs::TempDir::new().unwrap(); + let sample_path = temp.child("sample"); + sample_path.write_str(sample).unwrap(); + + let corrections = typos_cli::dict::BuiltIn::new(Default::default()); + let parser = typos::tokens::Tokenizer::new(); + let checks = typos_cli::checks::TyposSettings::new().build_word_parser(); + b.iter(|| { + checks.check_file( + sample_path.path(), + true, + &parser, + &corrections, + &typos_cli::report::PrintSilent, + ) + }); + + temp.close().unwrap(); + }); + group.bench_with_input(BenchmarkId::new("typos", name), &len, |b, _| { + let temp = assert_fs::TempDir::new().unwrap(); + let sample_path = temp.child("sample"); + sample_path.write_str(sample).unwrap(); + + let corrections = typos_cli::dict::BuiltIn::new(Default::default()); + let parser = typos::tokens::Tokenizer::new(); + let checks = typos_cli::checks::TyposSettings::new().build_typos(); + b.iter(|| { + checks.check_file( + sample_path.path(), + true, + &parser, + &corrections, + &typos_cli::report::PrintSilent, + ) + }); + + temp.close().unwrap(); + }); + } + group.finish(); } -#[bench] -fn files_empty(b: &mut test::Bencher) { - bench_files(data::EMPTY, b); -} - -#[bench] -fn files_no_tokens(b: &mut test::Bencher) { - bench_files(data::NO_TOKENS, b); -} - -#[bench] -fn files_single_token(b: &mut test::Bencher) { - bench_files(data::SINGLE_TOKEN, b); -} - -#[bench] -fn files_sherlock(b: &mut test::Bencher) { - bench_files(data::SHERLOCK, b); -} - -#[bench] -fn files_code(b: &mut test::Bencher) { - bench_files(data::CODE, b); -} - -#[bench] -fn files_corpus(b: &mut test::Bencher) { - bench_files(data::CORPUS, b); -} - -fn bench_identifiers(data: &str, b: &mut test::Bencher) { - let temp = assert_fs::TempDir::new().unwrap(); - let sample_path = temp.child("sample"); - sample_path.write_str(data).unwrap(); - - let corrections = typos_cli::dict::BuiltIn::new(Default::default()); - let parser = typos::tokens::Tokenizer::new(); - let checks = typos_cli::checks::TyposSettings::new().build_identifier_parser(); - b.iter(|| { - checks.check_file( - sample_path.path(), - true, - &parser, - &corrections, - &typos_cli::report::PrintSilent, - ) - }); - - temp.close().unwrap(); -} - -#[bench] -fn identifiers_empty(b: &mut test::Bencher) { - bench_identifiers(data::EMPTY, b); -} - -#[bench] -fn identifiers_no_tokens(b: &mut test::Bencher) { - bench_identifiers(data::NO_TOKENS, b); -} - -#[bench] -fn identifiers_single_token(b: &mut test::Bencher) { - bench_identifiers(data::SINGLE_TOKEN, b); -} - -#[bench] -fn identifiers_sherlock(b: &mut test::Bencher) { - bench_identifiers(data::SHERLOCK, b); -} - -#[bench] -fn identifiers_code(b: &mut test::Bencher) { - bench_identifiers(data::CODE, b); -} - -#[bench] -fn identifiers_corpus(b: &mut test::Bencher) { - bench_identifiers(data::CORPUS, b); -} - -fn bench_words(data: &str, b: &mut test::Bencher) { - let temp = assert_fs::TempDir::new().unwrap(); - let sample_path = temp.child("sample"); - sample_path.write_str(data).unwrap(); - - let corrections = typos_cli::dict::BuiltIn::new(Default::default()); - let parser = typos::tokens::Tokenizer::new(); - let checks = typos_cli::checks::TyposSettings::new().build_word_parser(); - b.iter(|| { - checks.check_file( - sample_path.path(), - true, - &parser, - &corrections, - &typos_cli::report::PrintSilent, - ) - }); - - temp.close().unwrap(); -} - -#[bench] -fn words_empty(b: &mut test::Bencher) { - bench_words(data::EMPTY, b); -} - -#[bench] -fn words_no_tokens(b: &mut test::Bencher) { - bench_words(data::NO_TOKENS, b); -} - -#[bench] -fn words_single_token(b: &mut test::Bencher) { - bench_words(data::SINGLE_TOKEN, b); -} - -#[bench] -fn words_sherlock(b: &mut test::Bencher) { - bench_words(data::SHERLOCK, b); -} - -#[bench] -fn words_code(b: &mut test::Bencher) { - bench_words(data::CODE, b); -} - -#[bench] -fn words_corpus(b: &mut test::Bencher) { - bench_words(data::CORPUS, b); -} - -fn bench_typos(data: &str, b: &mut test::Bencher) { - let temp = assert_fs::TempDir::new().unwrap(); - let sample_path = temp.child("sample"); - sample_path.write_str(data).unwrap(); - - let corrections = typos_cli::dict::BuiltIn::new(Default::default()); - let parser = typos::tokens::Tokenizer::new(); - let checks = typos_cli::checks::TyposSettings::new().build_typos(); - b.iter(|| { - checks.check_file( - sample_path.path(), - true, - &parser, - &corrections, - &typos_cli::report::PrintSilent, - ) - }); - - temp.close().unwrap(); -} - -#[bench] -fn typos_empty(b: &mut test::Bencher) { - bench_typos(data::EMPTY, b); -} - -#[bench] -fn typos_no_tokens(b: &mut test::Bencher) { - bench_typos(data::NO_TOKENS, b); -} - -#[bench] -fn typos_single_token(b: &mut test::Bencher) { - bench_typos(data::SINGLE_TOKEN, b); -} - -#[bench] -fn typos_sherlock(b: &mut test::Bencher) { - bench_typos(data::SHERLOCK, b); -} - -#[bench] -fn typos_code(b: &mut test::Bencher) { - bench_typos(data::CODE, b); -} - -#[bench] -fn typos_corpus(b: &mut test::Bencher) { - bench_typos(data::CORPUS, b); -} +criterion_group!(benches, bench_checks,); +criterion_main!(benches); diff --git a/benches/corrections.rs b/benches/corrections.rs index 0e3a7f4..303c1bf 100644 --- a/benches/corrections.rs +++ b/benches/corrections.rs @@ -1,29 +1,34 @@ -#![feature(test)] +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; -extern crate test; - -#[bench] -fn load_corrections(b: &mut test::Bencher) { - b.iter(|| typos_cli::dict::BuiltIn::new(Default::default())); +fn bench_dict_load(c: &mut Criterion) { + let mut group = c.benchmark_group("load"); + group.bench_function(BenchmarkId::new("load", "builtin"), |b| { + b.iter(|| typos_cli::dict::BuiltIn::new(Default::default())); + }); + group.finish(); } -#[bench] -fn correct_word_hit(b: &mut test::Bencher) { - let corrections = typos_cli::dict::BuiltIn::new(Default::default()); - let input = typos::tokens::Word::new("successs", 0).unwrap(); - assert_eq!( - corrections.correct_word(input), - Some(typos::Status::Corrections(vec![ - std::borrow::Cow::Borrowed("successes") - ])) - ); - b.iter(|| corrections.correct_word(input)); +fn bench_dict_lookup(c: &mut Criterion) { + let mut group = c.benchmark_group("lookup"); + group.bench_function(BenchmarkId::new("lookup", "hit"), |b| { + let corrections = typos_cli::dict::BuiltIn::new(Default::default()); + let input = typos::tokens::Word::new("successs", 0).unwrap(); + assert_eq!( + corrections.correct_word(input), + Some(typos::Status::Corrections(vec![ + std::borrow::Cow::Borrowed("successes") + ])) + ); + b.iter(|| corrections.correct_word(input)); + }); + group.bench_function(BenchmarkId::new("lookup", "miss"), |b| { + let corrections = typos_cli::dict::BuiltIn::new(Default::default()); + let input = typos::tokens::Word::new("success", 0).unwrap(); + assert!(corrections.correct_word(input).is_none()); + b.iter(|| corrections.correct_word(input)); + }); + group.finish(); } -#[bench] -fn correct_word_miss(b: &mut test::Bencher) { - let corrections = typos_cli::dict::BuiltIn::new(Default::default()); - let input = typos::tokens::Word::new("success", 0).unwrap(); - assert!(corrections.correct_word(input).is_none()); - b.iter(|| corrections.correct_word(input)); -} +criterion_group!(benches, bench_dict_load, bench_dict_lookup); +criterion_main!(benches); diff --git a/benches/data.rs b/benches/data.rs index be89d07..39e6c3a 100644 --- a/benches/data.rs +++ b/benches/data.rs @@ -1,11 +1,11 @@ -pub const EMPTY: &str = ""; +pub static EMPTY: &str = ""; -pub const NO_TOKENS: &str = " "; +pub static NO_TOKENS: &str = " "; -pub const SINGLE_TOKEN: &str = "success"; +pub static SINGLE_TOKEN: &str = "success"; // Stolen from https://github.com/BurntSushi/ripgrep/blob/master/grep-searcher/src/searcher/glue.rs -pub const SHERLOCK: &'static str = "\ +pub static SHERLOCK: &str = "\ For the Doctor Watsons of this world, as opposed to the Sherlock Holmeses, success in the province of detective work must always be, to a very large extent, the result of luck. Sherlock Holmes @@ -15,7 +15,7 @@ and exhibited clearly, with a label attached.\ "; // Stolen from https://github.com/BurntSushi/ripgrep/blob/master/grep-searcher/src/searcher/glue.rs -pub const CODE: &'static str = "\ +pub static CODE: &str = "\ extern crate snap; use std::io; fn main() { @@ -28,4 +28,13 @@ fn main() { } "; -pub const CORPUS: &str = include_str!("../crates/typos-dict/assets/words.csv"); +pub static CORPUS: &str = include_str!("../crates/typos-dict/assets/words.csv"); + +pub static DATA: &[(&str, &str)] = &[ + ("empty", EMPTY), + ("no_tokens", NO_TOKENS), + ("single_token", SINGLE_TOKEN), + ("sherlock", SHERLOCK), + ("code", CODE), + ("corpus", CORPUS), +]; diff --git a/benches/tokenize.rs b/benches/tokenize.rs index efcce0b..f86e61c 100644 --- a/benches/tokenize.rs +++ b/benches/tokenize.rs @@ -1,71 +1,22 @@ -#![feature(test)] - -extern crate test; - mod data; -#[bench] -fn ident_parse_empty(b: &mut test::Bencher) { - let parser = typos::tokens::Tokenizer::new(); - b.iter(|| parser.parse_bytes(data::EMPTY.as_bytes()).last()); +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; + +fn bench_tokenize(c: &mut Criterion) { + let mut group = c.benchmark_group("tokenize"); + for (name, sample) in data::DATA { + let len = sample.len(); + group.bench_with_input(BenchmarkId::new("ident", name), &len, |b, _| { + let parser = typos::tokens::Tokenizer::new(); + b.iter(|| parser.parse_bytes(sample.as_bytes()).last()); + }); + group.bench_with_input(BenchmarkId::new("words", name), &len, |b, _| { + let symbol = typos::tokens::Identifier::new_unchecked(sample, 0); + b.iter(|| symbol.split().last()); + }); + } + group.finish(); } -#[bench] -fn ident_parse_no_tokens(b: &mut test::Bencher) { - let parser = typos::tokens::Tokenizer::new(); - b.iter(|| parser.parse_bytes(data::NO_TOKENS.as_bytes()).last()); -} - -#[bench] -fn ident_parse_single_token(b: &mut test::Bencher) { - let parser = typos::tokens::Tokenizer::new(); - b.iter(|| { - parser.parse_bytes(data::SINGLE_TOKEN.as_bytes()).last(); - }); -} - -#[bench] -fn ident_parse_sherlock(b: &mut test::Bencher) { - let parser = typos::tokens::Tokenizer::new(); - b.iter(|| parser.parse_bytes(data::SHERLOCK.as_bytes()).last()); -} - -#[bench] -fn ident_parse_code(b: &mut test::Bencher) { - let parser = typos::tokens::Tokenizer::new(); - b.iter(|| parser.parse_bytes(data::CODE.as_bytes()).last()); -} - -#[bench] -fn ident_parse_corpus(b: &mut test::Bencher) { - let parser = typos::tokens::Tokenizer::new(); - b.iter(|| parser.parse_bytes(data::CORPUS.as_bytes()).last()); -} - -#[bench] -fn ident_split_lowercase_short(b: &mut test::Bencher) { - let input = "abcabcabcabc"; - let symbol = typos::tokens::Identifier::new_unchecked(input, 0); - b.iter(|| symbol.split().last()); -} - -#[bench] -fn ident_split_lowercase_long(b: &mut test::Bencher) { - let input = "abcabcabcabc".repeat(90); - let symbol = typos::tokens::Identifier::new_unchecked(&input, 0); - b.iter(|| symbol.split().last()); -} - -#[bench] -fn ident_split_mixed_short(b: &mut test::Bencher) { - let input = "abcABCAbc123"; - let symbol = typos::tokens::Identifier::new_unchecked(input, 0); - b.iter(|| symbol.split().last()); -} - -#[bench] -fn ident_split_mixed_long(b: &mut test::Bencher) { - let input = "abcABCAbc123".repeat(90); - let symbol = typos::tokens::Identifier::new_unchecked(&input, 0); - b.iter(|| symbol.split().last()); -} +criterion_group!(benches, bench_tokenize); +criterion_main!(benches); diff --git a/committed.toml b/committed.toml index e0cfbbd..08815cf 100644 --- a/committed.toml +++ b/committed.toml @@ -1,2 +1,3 @@ style="conventional" ignore_author_re="dependabot" +merge_commit = false diff --git a/release.toml b/release.toml index c2b7cf6..4b584b5 100644 --- a/release.toml +++ b/release.toml @@ -1,4 +1,11 @@ pre-release-commit-message = "chore({{crate_name}}): Release {{version}}" no-dev-version = true -tag-message = "{{prefix}}v{{version}}" +tag-message = "{{tag_name}}" tag-name = "{{prefix}}v{{version}}" +pre-release-replacements = [ + {file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1}, + {file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1}, + {file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1}, + {file="CHANGELOG.md", search="", replace="\n## [Unreleased] - ReleaseDate\n", exactly=1}, + {file="CHANGELOG.md", search="", replace="\n[Unreleased]: https://github.com/assert-rs/predicates-rs/compare/{{tag_name}}...HEAD", exactly=1}, +]