diff --git a/.cz.toml b/.cz.toml index 5e0ab260..6fa19cda 100644 --- a/.cz.toml +++ b/.cz.toml @@ -32,17 +32,17 @@ schema_pattern = "(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test) type = "list" name = "change_type" choices = [ - { value = "build", name = "build: Changes that affect the build system or external dependencies (example scopes: pip, docker, npm)", key = "b" }, - { value = "chore", name = "chore: A modification that generally does not fall into any other category", key = "c" }, - { value = "ci", name = "ci: Changes to our CI configuration files and scripts (example scopes: GitLabCI)", key = "i" }, - { value = "docs", name = "docs: Documentation only changes", key = "d" }, - { value = "feat", name = "feat: A new feature.", key = "f" }, - { value = "fix", name = "fix: A bug fix.", key = "x" }, - { value = "perf", name = "perf: A code change that improves performance", key = "p" }, - { value = "refactor", name = "refactor: A code change that neither fixes a bug nor adds a feature", key = "r" }, - { value = "revert", name = "revert: Revert previous commits", key = "v" }, - { value = "style", name = "style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)", key = "s" }, - { value = "test", name = "test: Adding missing or correcting existing tests", key = "t" }, + { value = "build", name = "build: Changes that affect the build system or external dependencies (example scopes: pip, docker, npm)", key = "b" }, + { value = "chore", name = "chore: A modification that generally does not fall into any other category", key = "c" }, + { value = "ci", name = "ci: Changes to our CI configuration files and scripts (example scopes: GitLabCI)", key = "i" }, + { value = "docs", name = "docs: Documentation only changes", key = "d" }, + { value = "feat", name = "feat: A new feature.", key = "f" }, + { value = "fix", name = "fix: A bug fix.", key = "x" }, + { value = "perf", name = "perf: A code change that improves performance", key = "p" }, + { value = "refactor", name = "refactor: A code change that neither fixes a bug nor adds a feature", key = "r" }, + { value = "revert", name = "revert: Revert previous commits", key = "v" }, + { value = "style", name = "style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)", key = "s" }, + { value = "test", name = "test: Adding missing or correcting existing tests", key = "t" }, ] message = "Select the type of change you are committing" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f5d988b..62a9bfd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,11 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly with: { components: rustfmt } - - run: cargo xtask lint-formatting + - uses: Swatinem/rust-cache@v2 + - uses: taiki-e/install-action@v2 + with: + tool: taplo-cli + - run: cargo xtask format --check # Check for typos in the codebase. # See @@ -55,7 +59,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - uses: bnjbvr/cargo-machete@v0.7.0 # Run cargo clippy. @@ -67,7 +70,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: { components: clippy } - uses: Swatinem/rust-cache@v2 - - run: cargo xtask lint-clippy + - run: cargo xtask clippy # Run markdownlint on all markdown files in the repository. lint-markdown: @@ -114,7 +117,7 @@ jobs: with: toolchain: ${{ matrix.toolchain }} - uses: Swatinem/rust-cache@v2 - - run: cargo xtask check + - run: cargo xtask check --all-features # Check if README.md is up-to-date with the crate's documentation. check-readme: @@ -124,7 +127,7 @@ jobs: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@cargo-rdme - - run: cargo xtask check-readme + - run: cargo xtask readme --check # Run cargo rustdoc with the same options that would be used by docs.rs, taking into account the # package.metadata.docs.rs configured in Cargo.toml. https://github.com/dtolnay/cargo-docs-rs @@ -138,7 +141,7 @@ jobs: - uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/install@cargo-docs-rs - uses: Swatinem/rust-cache@v2 - - run: cargo xtask lint-docs + - run: cargo xtask docs # Run cargo test on the documentation of the crate. This will catch any code examples that don't # compile, or any other issues in the documentation. diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 00000000..83b717f7 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,12 @@ +include = ["**/*.toml"] + +[formatting] +column_width = 100 +reorder_keys = false + +[[rule]] +include = ["**/Cargo.toml"] +keys = ["dependencies", "dev-dependencies", "build-dependencies", "workspace.dependencies"] + +[rule.formatting] +reorder_keys = true diff --git a/Cargo.lock b/Cargo.lock index d2af9907..bd0c160c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -94,11 +94,12 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", + "once_cell", "windows-sys 0.59.0", ] @@ -143,7 +144,7 @@ dependencies = [ "argh_shared", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -169,13 +170,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -347,7 +348,7 @@ dependencies = [ "semver 1.0.24", "serde", "serde_json", - "thiserror 2.0.9", + "thiserror 2.0.11", ] [[package]] @@ -373,9 +374,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.5" +version = "1.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" +checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" dependencies = [ "shlex", ] @@ -445,9 +446,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783" dependencies = [ "clap_builder", "clap_derive", @@ -455,9 +456,9 @@ dependencies = [ [[package]] name = "clap-cargo" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e3340d63f960ad376843dd750fb2aa4ac1b79e10775a070882bd135edfce303" +checksum = "d546f0e84ff2bfa4da1ce9b54be42285767ba39c688572ca32412a09a73851e5" dependencies = [ "anstyle", "cargo_metadata", @@ -473,14 +474,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2678fade3b77aa3a8ff3aae87e9c008d3fb00473a41c71fbf74e91c8c7b37e84" dependencies = [ "clap", - "log", + "tracing-core", ] [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121" dependencies = [ "anstream", "anstyle", @@ -490,14 +491,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -560,9 +561,9 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "compact_str" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" +checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32" dependencies = [ "castaway", "cfg-if", @@ -741,7 +742,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -752,7 +753,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -840,7 +841,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1051,7 +1052,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1121,9 +1122,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "half" @@ -1412,7 +1413,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1485,7 +1486,7 @@ dependencies = [ "indoc", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -1541,9 +1542,9 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -1622,9 +1623,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "litemap" @@ -1650,9 +1651,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "lru" @@ -1975,7 +1976,7 @@ dependencies = [ "by_address", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -2030,7 +2031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 2.0.9", + "thiserror 2.0.11", "ucd-trie", ] @@ -2054,7 +2055,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -2070,9 +2071,9 @@ dependencies = [ [[package]] name = "phf" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ "phf_macros", "phf_shared", @@ -2080,9 +2081,9 @@ dependencies = [ [[package]] name = "phf_codegen" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" dependencies = [ "phf_generator", "phf_shared", @@ -2090,9 +2091,9 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ "phf_shared", "rand 0.8.5", @@ -2100,51 +2101,51 @@ dependencies = [ [[package]] name = "phf_macros" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" dependencies = [ "phf_generator", "phf_shared", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] name = "phf_shared" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "siphasher", + "siphasher 1.0.1", ] [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -2216,18 +2217,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -2447,7 +2448,7 @@ dependencies = [ "serde", "serde_json", "strum", - "thiserror 2.0.9", + "thiserror 2.0.11", "unicode-segmentation", "unicode-truncate", "unicode-width", @@ -2655,7 +2656,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.91", + "syn 2.0.96", "unicode-ident", ] @@ -2682,9 +2683,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.42" +version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" +checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ "bitflags 2.7.0", "errno", @@ -2695,9 +2696,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.20" +version = "0.23.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" +checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" dependencies = [ "log", "once_cell", @@ -2739,9 +2740,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -2784,9 +2785,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d3f8c9bfcc3cbb6b0179eb57042d75b1582bdc65c3cb95f3fa999509c03cbc" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ "bitflags 2.7.0", "core-foundation", @@ -2797,9 +2798,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.13.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fd3768cd83c56a7f60faa4dc0d403f1b6df0a38c3c25f44b7894e45370d5" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -2849,7 +2850,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -2954,13 +2955,13 @@ dependencies = [ [[package]] name = "simple_asn1" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb" dependencies = [ "num-bigint", "num-traits", - "thiserror 1.0.69", + "thiserror 2.0.11", "time", ] @@ -2979,6 +2980,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.9" @@ -3012,7 +3019,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3074,7 +3081,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3096,9 +3103,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.91" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", @@ -3119,17 +3126,18 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] name = "tempfile" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", + "getrandom", "once_cell", "rustix", "windows-sys 0.59.0", @@ -3197,7 +3205,7 @@ dependencies = [ "semver 0.11.0", "sha2", "signal-hook", - "siphasher", + "siphasher 0.3.11", "tempfile", "terminfo", "termios", @@ -3224,11 +3232,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.9" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ - "thiserror-impl 2.0.9", + "thiserror-impl 2.0.11", ] [[package]] @@ -3239,18 +3247,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] name = "thiserror-impl" -version = "2.0.9" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3339,7 +3347,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3473,7 +3481,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -3619,9 +3627,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "744018581f9a3454a9e15beb8a33b017183f1e7c0cd170232a2d1453b23a51c4" dependencies = [ "atomic", "getrandom", @@ -3675,34 +3683,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3710,22 +3719,25 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "weather" @@ -3739,9 +3751,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -3779,7 +3791,7 @@ dependencies = [ "once_cell", "sha2", "thiserror 1.0.69", - "uuid 1.11.0", + "uuid 1.12.0", ] [[package]] @@ -3954,9 +3966,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" dependencies = [ "memchr", ] @@ -3983,8 +3995,8 @@ dependencies = [ "clap-verbosity-flag", "color-eyre", "duct", + "itertools 0.13.0", "tracing", - "tracing-log", "tracing-subscriber", ] @@ -4014,7 +4026,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "synstructure", ] @@ -4036,7 +4048,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] [[package]] @@ -4056,7 +4068,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", "synstructure", ] @@ -4085,5 +4097,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.91", + "syn 2.0.96", ] diff --git a/Cargo.toml b/Cargo.toml index ce6213ad..09da88a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,14 +2,14 @@ resolver = "2" members = ["ratatui", "ratatui-*", "xtask", "examples/apps/*"] default-members = [ - "ratatui", - "ratatui-core", - "ratatui-crossterm", - # this is not included as it doesn't compile on windows - # "ratatui-termion", - "ratatui-termwiz", - "ratatui-widgets", - "examples/apps/*", + "ratatui", + "ratatui-core", + "ratatui-crossterm", + # this is not included as it doesn't compile on windows + # "ratatui-termion", + "ratatui-termwiz", + "ratatui-widgets", + "examples/apps/*", ] [workspace.package] @@ -47,8 +47,8 @@ strum = { version = "0.26.3", features = ["derive"] } termwiz = { version = "0.22.0" } unicode-segmentation = "1.12.0" # See for information about why we pin unicode-width -unicode-width = "=0.2.0" termion = "4.0.0" +unicode-width = "=0.2.0" # Improve benchmark consistency [profile.bench] diff --git a/bacon.toml b/bacon.toml index 43ca2a6c..22dcda8a 100644 --- a/bacon.toml +++ b/bacon.toml @@ -8,91 +8,57 @@ default_job = "check" [jobs.check] -command = ["cargo", "check", "--all-features"] +command = ["cargo", "xtask", "check"] need_stdout = false [jobs.check-all] -command = ["cargo", "check", "--all-targets", "--all-features"] +command = ["cargo", "xtask", "check", "--all-features"] need_stdout = false [jobs.check-crossterm] -command = ["cargo", "check", "--all-targets", "--no-default-features", "--features", "crossterm"] +command = ["cargo", "xtask", "check-crossterm"] need_stdout = false [jobs.check-termion] -command = ["cargo", "check", "--all-targets", "--no-default-features", "--features", "termion"] +command = ["cargo", "xtask", "check-termion"] need_stdout = false [jobs.check-termwiz] -command = ["cargo", "check", "--all-targets", "--no-default-features", "--features", "termwiz"] +command = ["cargo", "xtask", "check-termwiz"] need_stdout = false [jobs.clippy-all] -command = ["cargo", "xtask", "lint-clippy"] +command = ["cargo", "xtask", "clippy"] need_stdout = false [jobs.test] -command = ["cargo", "test", "--all-features"] +command = ["cargo", "xtask", "test"] need_stdout = true [jobs.test-unit] -command = ["cargo", "test", "--lib", "--all-features"] +command = ["cargo", "xtask", "test-libs"] need_stdout = true [jobs.doc] -command = [ - "cargo", - "+nightly", - "doc", - "-Zunstable-options", - "-Zrustdoc-scrape-examples", - "--all-features", - "--no-deps", -] -env.RUSTDOCFLAGS = "--cfg docsrs" +command = ["cargo", "xtask", "docs"] need_stdout = false -# If the doc compiles, then it opens in your browser and bacon switches -# to the previous job [jobs.doc-open] -command = [ - "cargo", - "+nightly", - "doc", - "-Zunstable-options", - "-Zrustdoc-scrape-examples", - "--all-features", - "--no-deps", - "--open", -] -env.RUSTDOCFLAGS = "--cfg docsrs" +command = ["cargo", "xtask", "docs", "--open"] +on_success = "job:doc" need_stdout = false -on_success = "job:doc" # so that we don't open the browser at each change [jobs.coverage] -command = ["cargo", "llvm-cov", "--lcov", "--output-path", "target/lcov.info", "--all-features"] +command = ["cargo", "xtask", "coverage"] [jobs.coverage-unit-tests-only] -command = [ - "cargo", - "llvm-cov", - "--lcov", - "--output-path", - "target/lcov.info", - "--lib", - "--all-features", -] +command = ["cargo", "xtask", "coverage-unit"] [jobs.hack] -command = [ - "cargo", - "hack", - "test", - "--lib", - "--each-feature", - # "--all-targets", - "--workspace", -] +command = ["cargo", "xtask", "hack"] + +[jobs.format] +command = ["cargo", "xtask", "format"] # You may define here keybindings that would be specific to # a project, for example a shortcut to launch a specific job. @@ -107,3 +73,4 @@ v = "job:coverage" ctrl-v = "job:coverage-unit-tests-only" u = "job:test-unit" n = "job:nextest" +f = "job:format" diff --git a/deny.toml b/deny.toml index b026012a..ae196c7f 100644 --- a/deny.toml +++ b/deny.toml @@ -4,16 +4,16 @@ version = 2 confidence-threshold = 0.8 allow = [ - "Apache-2.0", - "BSD-2-Clause", - "BSD-3-Clause", - "ISC", - "MIT", - "OpenSSL", - "Unicode-3.0", - "Unicode-DFS-2016", - "WTFPL", - "Zlib", + "Apache-2.0", + "BSD-2-Clause", + "BSD-3-Clause", + "ISC", + "MIT", + "OpenSSL", + "Unicode-3.0", + "Unicode-DFS-2016", + "WTFPL", + "Zlib", ] [advisories] diff --git a/ratatui-termion/Cargo.toml b/ratatui-termion/Cargo.toml index fdc3de1f..86789bd1 100644 --- a/ratatui-termion/Cargo.toml +++ b/ratatui-termion/Cargo.toml @@ -30,9 +30,9 @@ unstable-backend-writer = [] [dependencies] document-features = { workspace = true, optional = true } +instability.workspace = true ratatui-core = { workspace = true } termion.workspace = true -instability.workspace = true [dev-dependencies] rstest.workspace = true diff --git a/ratatui-widgets/Cargo.toml b/ratatui-widgets/Cargo.toml index 7593279d..6db2b75b 100644 --- a/ratatui-widgets/Cargo.toml +++ b/ratatui-widgets/Cargo.toml @@ -48,17 +48,17 @@ unstable-rendered-line-info = [] [dependencies] bitflags.workspace = true -itertools.workspace = true +document-features = { workspace = true, optional = true } indoc.workspace = true instability.workspace = true +itertools.workspace = true +line-clipping = "0.2.1" ratatui-core = { workspace = true } +serde = { workspace = true, optional = true } strum.workspace = true time = { version = "0.3.11", optional = true, features = ["local-offset"] } unicode-segmentation.workspace = true unicode-width.workspace = true -serde = { workspace = true, optional = true } -document-features = { workspace = true, optional = true } -line-clipping = "0.2.1" [dev-dependencies] color-eyre.workspace = true diff --git a/ratatui/Cargo.toml b/ratatui/Cargo.toml index 9c18af66..5851c582 100644 --- a/ratatui/Cargo.toml +++ b/ratatui/Cargo.toml @@ -46,10 +46,10 @@ palette = ["ratatui-core/palette", "dep:palette"] ## Use terminal scrolling regions to make some operations less prone to ## flickering. (i.e. Terminal::insert_before). scrolling-regions = [ - "ratatui-core/scrolling-regions", - "ratatui-crossterm?/scrolling-regions", - "ratatui-termion?/scrolling-regions", - "ratatui-termwiz?/scrolling-regions", + "ratatui-core/scrolling-regions", + "ratatui-crossterm?/scrolling-regions", + "ratatui-termion?/scrolling-regions", + "ratatui-termwiz?/scrolling-regions", ] ## enables all widgets. @@ -66,9 +66,9 @@ widget-calendar = ["ratatui-widgets/calendar", "dep:time"] ## Underline color is only supported by the Crossterm and Termwiz backends, and is not supported on ## Windows 7. underline-color = [ - "ratatui-core/underline-color", - "ratatui-crossterm?/underline-color", - "ratatui-termwiz?/underline-color", + "ratatui-core/underline-color", + "ratatui-crossterm?/underline-color", + "ratatui-termwiz?/underline-color", ] #! The following features are unstable and may change in the future: @@ -91,8 +91,8 @@ unstable-widget-ref = [] ## Enables getting access to backends' writers. unstable-backend-writer = [ - "ratatui-crossterm?/unstable-backend-writer", - "ratatui-termion?/unstable-backend-writer", + "ratatui-crossterm?/unstable-backend-writer", + "ratatui-termion?/unstable-backend-writer", ] [dependencies] diff --git a/rustfmt.toml b/rustfmt.toml index 9e26793f..bc3bf8a4 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,9 +1,9 @@ # configuration for https://rust-lang.github.io/rustfmt/ comment_width = 100 format_code_in_doc_comments = true -format_macro_matchers=true +format_macro_matchers = true group_imports = "StdExternalCrate" imports_granularity = "Crate" -normalize_doc_attributes=true -use_field_init_shorthand=true +normalize_doc_attributes = true +use_field_init_shorthand = true wrap_comments = true diff --git a/xtask/Cargo.lock b/xtask/Cargo.lock deleted file mode 100644 index 9b71ead2..00000000 --- a/xtask/Cargo.lock +++ /dev/null @@ -1,248 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "anstream" -version = "0.6.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56" - -[[package]] -name = "anstyle-parse" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" -dependencies = [ - "anstyle", - "windows-sys", -] - -[[package]] -name = "clap" -version = "4.5.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap-cargo" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b2ea69cefa96b848b73ad516ad1d59a195cdf9263087d977f648a818c8b43e" -dependencies = [ - "anstyle", - "clap", -] - -[[package]] -name = "clap_builder" -version = "4.5.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" - -[[package]] -name = "colorchoice" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - -[[package]] -name = "proc-macro2" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "xtask" -version = "0.1.0" -dependencies = [ - "clap", - "clap-cargo", -] diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index fd781c18..f8d9a7f8 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -8,9 +8,9 @@ license.workspace = true cargo_metadata = "0.19.1" clap = { version = "4.5.23", features = ["derive"] } clap-cargo = { version = "0.15.1", features = ["cargo_metadata"] } -clap-verbosity-flag = "3.0.2" +clap-verbosity-flag = { version = "3.0.2", default-features = false, features = ["tracing"] } color-eyre = "0.6.3" duct = "0.13.7" +itertools.workspace = true tracing = "0.1.40" -tracing-log = "0.2.0" -tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +tracing-subscriber = { version = "0.3.18" } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 1d8e735f..0440b7fa 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -11,14 +11,13 @@ use clap::{Parser, Subcommand, ValueEnum}; use clap_verbosity_flag::{InfoLevel, Verbosity}; use color_eyre::{eyre::Context, Result}; use duct::cmd; -use tracing::level_filters::LevelFilter; -use tracing_log::AsTrace; +use itertools::{Itertools, Position}; fn main() -> Result<()> { color_eyre::install()?; let args = Args::parse(); tracing_subscriber::fmt() - .with_max_level(args.log_level()) + .with_max_level(args.verbosity) .without_time() .init(); @@ -46,10 +45,6 @@ impl Args { fn run(self) -> Result<()> { self.command.run() } - - fn log_level(&self) -> LevelFilter { - self.verbosity.log_level_filter().as_trace() - } } #[derive(Clone, Debug, Subcommand)] @@ -61,57 +56,56 @@ enum Command { #[command(visible_alias = "b")] Build, - /// Run cargo check #[command(visible_alias = "c")] - Check, + Check(CheckCommand), - /// Check if README.md is up-to-date - #[command(visible_alias = "cr")] - CheckReadme, + /// Run cargo check with crossterm feature + #[command(visible_alias = "cc")] + CheckCrossterm, + + /// Run cargo check with termion feature + #[command(visible_alias = "ct")] + CheckTermion, + + /// Run cargo check with termwiz feature + #[command(visible_alias = "cw")] + CheckTermwiz, + + /// Check if README.md is up-to-date (using cargo-rdme) + #[command(visible_alias = "cr", alias = "rdme")] + Readme(ReadmeCommand), /// Generate code coverage report #[command(visible_alias = "cov")] Coverage, + /// Generate code coverage for unit tests only + #[command(visible_alias = "covu")] + CoverageUnit, + /// Lint formatting, typos, clippy, and docs #[command(visible_alias = "l")] Lint, /// Run clippy on the project #[command(visible_alias = "cl")] - LintClippy, + Clippy(ClippyCommand), /// Check documentation for errors and warnings - #[command(visible_alias = "d")] - LintDocs, + #[command(name = "docs", visible_alias = "d")] + Docs(DocsCommand), /// Check for formatting issues in the project - #[command(visible_alias = "lf")] - LintFormatting, + #[command(visible_aliases = ["fmt", "f"])] + Format(FormatCommand), /// Lint markdown files #[command(visible_alias = "md")] LintMarkdown, /// Check for typos in the project - #[command(visible_alias = "lt")] - LintTypos, - - /// Fix clippy warnings in the project - #[command(visible_alias = "fc")] - FixClippy, - - /// Fix formatting issues in the project - #[command(visible_alias = "fmt")] - FixFormatting, - - /// Fix README.md (by running cargo-rdme) - #[command(visible_alias = "fr")] - FixReadme, - - /// Fix typos in the project - #[command(visible_alias = "typos")] - FixTypos, + #[command(visible_alias = "ty")] + Typos(TyposCommand), /// Run tests #[command(visible_alias = "t")] @@ -128,6 +122,58 @@ enum Command { /// Run lib tests #[command(visible_alias = "tl")] TestLibs, + + /// Run cargo hack to test each feature in isolation + #[command(visible_alias = "h")] + Hack, +} + +/// Run cargo check +#[derive(Clone, Debug, clap::Args)] +struct CheckCommand { + /// Check all features + #[arg(long, visible_alias = "all")] + all_features: bool, +} + +/// Check documentation for errors and warnings +#[derive(Clone, Debug, clap::Args)] +struct DocsCommand { + /// Open the documentation in the browser + #[arg(long)] + open: bool, +} + +/// Check for formatting issues in the project +#[derive(Clone, Debug, clap::Args)] +struct FormatCommand { + /// Check formatting issues + #[arg(long)] + check: bool, +} + +/// Run clippy on the project +#[derive(Clone, Debug, clap::Args)] +struct ClippyCommand { + /// Fix clippy warnings + #[arg(long)] + fix: bool, +} + +/// Check if README.md is up-to-date (using cargo-rdme) +#[derive(Clone, Debug, clap::Args)] +struct ReadmeCommand { + /// Check if README.md is up-to-date + #[arg(long)] + check: bool, +} + +/// Check for typos in the project +#[derive(Clone, Debug, clap::Args)] +struct TyposCommand { + /// Fix typos + #[arg(long)] + fix: bool, } #[derive(Clone, Debug, ValueEnum, PartialEq, Eq)] @@ -142,23 +188,24 @@ impl Command { match self { Command::CI => ci(), Command::Build => build(), - Command::Check => check(), - Command::CheckReadme => check_readme(), + Command::Check(command) => command.run(), + Command::CheckCrossterm => check_crossterm(), + Command::CheckTermion => check_termion(), + Command::CheckTermwiz => check_termwiz(), + Command::Readme(command) => command.run(), Command::Coverage => coverage(), + Command::CoverageUnit => coverage_unit(), Command::Lint => lint(), - Command::LintClippy => lint_clippy(), - Command::LintDocs => lint_docs(), - Command::LintFormatting => lint_format(), - Command::LintTypos => lint_typos(), + Command::Clippy(command) => command.run(), + Command::Docs(command) => command.run(), + Command::Format(command) => command.run(), + Command::Typos(command) => command.run(), Command::LintMarkdown => lint_markdown(), - Command::FixClippy => fix_clippy(), - Command::FixFormatting => fix_format(), - Command::FixReadme => fix_readme(), - Command::FixTypos => fix_typos(), Command::Test => test(), Command::TestBackend { backend } => test_backend(backend), Command::TestDocs => test_docs(), Command::TestLibs => test_libs(), + Command::Hack => hack(), } } } @@ -176,24 +223,71 @@ fn build() -> Result<()> { run_cargo(vec!["build", "--all-targets", "--all-features"]) } -/// Run cargo check -fn check() -> Result<()> { - run_cargo(vec!["check", "--all-targets", "--all-features"]) +impl CheckCommand { + fn run(self) -> Result<()> { + if self.all_features { + run_cargo(vec!["check", "--all-targets", "--all-features"]) + } else { + run_cargo(vec!["check", "--all-targets"]) + } + } } -/// Run cargo-rdme to check if README.md is up-to-date with the library documentation -fn check_readme() -> Result<()> { - for package in workspace_packages(TargetKind::Lib)? { - run_cargo(vec!["rdme", "--workspace-project", &package, "--check"])?; - } - Ok(()) +/// Run cargo check with crossterm feature +fn check_crossterm() -> Result<()> { + run_cargo(vec![ + "check", + "--all-targets", + "--all-features", + "--no-default-features", + "--features", + "crossterm", + ]) } -fn fix_readme() -> Result<()> { - for package in workspace_packages(TargetKind::Lib)? { - run_cargo(vec!["rdme", "--workspace-project", &package])?; +/// Run cargo check with termion feature +fn check_termion() -> Result<()> { + run_cargo(vec![ + "check", + "--all-targets", + "--all-features", + "--no-default-features", + "--features", + "termion", + ]) +} + +/// Run cargo check with termwiz feature +fn check_termwiz() -> Result<()> { + run_cargo(vec![ + "check", + "--all-targets", + "--all-features", + "--no-default-features", + "--features", + "termwiz", + ]) +} + +impl ReadmeCommand { + fn run(self) -> Result<()> { + let args = if self.check { + vec!["rdme", "--check"] + } else { + vec!["rdme"] + }; + for package in workspace_packages(TargetKind::Lib)? { + if package == "ratatui" { + // Skip the main crate as we removed rdme + continue; + } + let mut package_args = args.clone(); + package_args.push("--workspace-project"); + package_args.push(&package); + run_cargo(package_args)?; + } + Ok(()) } - Ok(()) } /// Generate code coverage report @@ -207,53 +301,61 @@ fn coverage() -> Result<()> { ]) } +/// Generate code coverage for unit tests only +fn coverage_unit() -> Result<()> { + run_cargo(vec![ + "llvm-cov", + "--lcov", + "--output-path", + "target/lcov-unit.info", + "--all-features", + "--lib", + ]) +} + /// Lint formatting, typos, clippy, and docs (and a soft fail on markdown) fn lint() -> Result<()> { - lint_clippy()?; - lint_docs()?; - lint_format()?; - lint_typos()?; + ClippyCommand { fix: false }.run()?; + DocsCommand { open: false }.run()?; + FormatCommand { check: true }.run()?; + TyposCommand { fix: false }.run()?; if let Err(err) = lint_markdown() { tracing::warn!("known issue: markdownlint is currently noisy and can be ignored: {err}"); } Ok(()) } -/// Run clippy on the project -fn lint_clippy() -> Result<()> { - run_cargo(vec![ - "clippy", - "--all-targets", - "--all-features", - "--tests", - "--benches", - "--", - "-D", - "warnings", - ]) -} - -/// Fix clippy warnings in the project -fn fix_clippy() -> Result<()> { - run_cargo(vec![ - "clippy", - "--all-targets", - "--all-features", - "--tests", - "--benches", - "--", - "-D", - "warnings", - "--fix", - ]) -} - -/// Check that docs build without errors using flags for docs.rs -fn lint_docs() -> Result<()> { - for package in workspace_packages(TargetKind::Lib)? { - run_cargo_nightly(vec!["docs-rs", "--package", &package])?; +impl ClippyCommand { + fn run(self) -> Result<()> { + let mut args = vec![ + "clippy", + "--all-targets", + "--all-features", + "--tests", + "--benches", + "--", + "-D", + "warnings", + ]; + if self.fix { + args.push("--fix"); + } + run_cargo(args) + } +} + +impl DocsCommand { + fn run(self) -> Result<()> { + let packages = workspace_packages(TargetKind::Lib)?; + for (position, package) in packages.iter().with_position() { + let mut args = vec!["docs-rs", "--package", &package]; + if self.open && matches!(position, Position::Last | Position::Only) { + args.push("--open"); + } + run_cargo_nightly(args)?; + } + Ok(()) } - Ok(()) } /// Return the available packages in the workspace @@ -270,14 +372,30 @@ fn workspace_packages(kind: TargetKind) -> Result> { Ok(packages) } -/// Lint formatting issues in the project -fn lint_format() -> Result<()> { - run_cargo_nightly(vec!["fmt", "--all", "--check"]) -} +impl FormatCommand { + fn run(self) -> Result<()> { + self.run_rustfmt()?; + self.run_taplo()?; + Ok(()) + } -/// Fix formatting issues in the project -fn fix_format() -> Result<()> { - run_cargo_nightly(vec!["fmt", "--all"]) + fn run_rustfmt(&self) -> Result<(), color_eyre::eyre::Error> { + let mut args = vec!["fmt", "--all"]; + if self.check { + args.push("--check"); + } + run_cargo_nightly(args)?; + Ok(()) + } + + fn run_taplo(&self) -> Result<(), color_eyre::eyre::Error> { + let mut args = vec!["format", "--colors", "always"]; + if self.check { + args.push("--check"); + } + cmd("taplo", args).run_with_trace()?; + Ok(()) + } } /// Lint markdown files using [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) @@ -286,16 +404,15 @@ fn lint_markdown() -> Result<()> { Ok(()) } -/// Check for typos in the project using [typos-cli](https://github.com/crate-ci/typos/) -fn lint_typos() -> Result<()> { - cmd!("typos").run_with_trace()?; - Ok(()) -} - -/// Fix typos in the project -fn fix_typos() -> Result<()> { - cmd!("typos", "-w").run_with_trace()?; - Ok(()) +impl TyposCommand { + fn run(self) -> Result<()> { + if self.fix { + cmd!("typos", "--write-changes").run_with_trace()?; + } else { + cmd!("typos").run_with_trace()?; + } + Ok(()) + } } /// Run tests for libs, backends, and docs @@ -334,7 +451,18 @@ fn test_docs() -> Result<()> { /// Run lib tests for the workspace's default packages fn test_libs() -> Result<()> { - run_cargo(vec!["test", "--all-targets", "--all-features"]) + run_cargo(vec!["test", "--lib", "--all-targets", "--all-features"]) +} + +/// Run cargo hack to test each feature in isolation +fn hack() -> Result<()> { + run_cargo(vec![ + "hack", + "test", + "--lib", + "--each-feature", + "--workspace", + ]) } /// Run a cargo subcommand with the default toolchain