diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..4a6a1ab --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[resolver] +incompatible-rust-versions = "fallback" diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 7ab13b9..27749d4 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -9,13 +9,13 @@ customManagers: [ { customType: 'regex', - fileMatch: [ - '^rust-toolchain\\.toml$', - 'Cargo.toml$', - 'clippy.toml$', - '\\.clippy.toml$', - '^\\.github/workflows/ci.yml$', - '^\\.github/workflows/rust-next.yml$', + managerFilePatterns: [ + '/^rust-toolchain\\.toml$/', + '/Cargo.toml$/', + '/clippy.toml$/', + '/\\.clippy.toml$/', + '/^\\.github/workflows/ci.yml$/', + '/^\\.github/workflows/rust-next.yml$/', ], matchStrings: [ 'STABLE.*?(?\\d+\\.\\d+(\\.\\d+)?)', diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07c2351..522da41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Build run: cargo test --workspace --no-run - name: Test - run: cargo hack test --feature-powerset --workspace + run: cargo hack test --each-feature --workspace msrv: name: "Check MSRV" runs-on: ubuntu-latest @@ -64,7 +64,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@cargo-hack - name: Default features - run: cargo hack check --feature-powerset --locked --rust-version --ignore-private --workspace --all-targets + run: cargo hack check --each-feature --locked --rust-version --ignore-private --workspace --all-targets --keep-going minimal-versions: name: Minimal versions runs-on: ubuntu-latest @@ -82,7 +82,7 @@ jobs: - name: Downgrade dependencies to minimal versions run: cargo +nightly generate-lockfile -Z minimal-versions - name: Compile with minimal versions - run: cargo +stable check --workspace --all-features --locked + run: cargo +stable check --workspace --all-features --locked --keep-going lockfile: runs-on: ubuntu-latest steps: @@ -109,7 +109,7 @@ jobs: - name: Check documentation env: RUSTDOCFLAGS: -D warnings - run: cargo doc --workspace --all-features --no-deps --document-private-items + run: cargo doc --workspace --all-features --no-deps --document-private-items --keep-going rustfmt: name: rustfmt runs-on: ubuntu-latest @@ -155,7 +155,7 @@ jobs: sarif_file: clippy-results.sarif wait-for-processing: true - name: Report status - run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated + run: cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings --allow deprecated coverage: name: Coverage runs-on: ubuntu-latest diff --git a/.github/workflows/rust-next.yml b/.github/workflows/rust-next.yml index 59d3e9e..9bfc8f5 100644 --- a/.github/workflows/rust-next.yml +++ b/.github/workflows/rust-next.yml @@ -40,7 +40,7 @@ jobs: - name: Build run: cargo test --workspace --no-run - name: Test - run: cargo hack test --feature-powerset --workspace + run: cargo hack test --each-feature --workspace latest: name: "Check latest dependencies" runs-on: ubuntu-latest @@ -58,4 +58,4 @@ jobs: - name: Build run: cargo test --workspace --no-run - name: Test - run: cargo hack test --feature-powerset --workspace + run: cargo hack test --each-feature --workspace diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 68db968..656c68e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,26 +1,19 @@ +default_install_hook_types: ["pre-commit", "commit-msg"] repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-yaml - stages: [commit] - id: check-json - stages: [commit] - id: check-toml - stages: [commit] - id: check-merge-conflict - stages: [commit] - id: check-case-conflict - stages: [commit] - id: detect-private-key - stages: [commit] - repo: https://github.com/crate-ci/typos - rev: v1.16.20 + rev: v1.32.0 hooks: - id: typos - stages: [commit] - repo: https://github.com/crate-ci/committed - rev: v1.0.20 + rev: v1.1.7 hooks: - id: committed - stages: [commit-msg] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ebc37be..3baae44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,18 +7,18 @@ appreciate any level you're willing to do. Need some new functionality to help? You can let us know by opening an [issue][new issue]. It's helpful to look through [all issues][all issues] in -case its already being talked about. +case it's already being talked about. ## Bug Reports Please let us know about what problems you run into, whether in behavior or ergonomics of API. You can do this by opening an [issue][new issue]. It's -helpful to look through [all issues][all issues] in case its already being +helpful to look through [all issues][all issues] in case it's already being talked about. ## Pull Requests -Looking for an idea? Check our [issues][issues]. If it's look more open ended, +Looking for an idea? Check our [issues][issues]. If the issue looks open ended, it is probably best to post on the issue how you are thinking of resolving the issue so you can get feedback early in the process. We want you to be successful and it can be discouraging to find out a lot of re-work is needed. @@ -41,15 +41,18 @@ As a heads up, we'll be running your PR through the following gauntlet: Not everything can be checked automatically though. We request that the commit history gets cleaned up. + We ask that commits are atomic, meaning they are complete and have a single responsibility. -PRs should tell a cohesive story, with test and refactor commits that keep the +A complete commit should build, pass tests, update documentation and tests, and not have dead code. + +PRs should tell a cohesive story, with refactor and test commits that keep the fix or feature commits simple and clear. Specifically, we would encourage - File renames be isolated into their own commit -- Add tests in a commit before their feature or fix, showing the current behavior. +- Add tests in a commit before their feature or fix, showing the current behavior (i.e. they should pass). The diff for the feature/fix commit will then show how the behavior changed, - making it clearer to reviewers and the community and showing people that the + making the commit's intent clearer to reviewers and the community, and showing people that the test is verifying the expected state. - e.g. [clap#5520](https://github.com/clap-rs/clap/pull/5520) diff --git a/Cargo.toml b/Cargo.toml index 012058e..e676d7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,14 +11,15 @@ include = [ "build.rs", "src/**/*", "Cargo.toml", + "Cargo.lock", "LICENSE*", "README.md", - "benches/**/*", "examples/**/*" ] [workspace.lints.rust] rust_2018_idioms = { level = "warn", priority = -1 } +unnameable_types = "warn" unreachable_pub = "warn" unsafe_op_in_unsafe_fn = "warn" unused_lifetimes = "warn" @@ -61,7 +62,7 @@ lossy_float_literal = "warn" macro_use_imports = "warn" mem_forget = "warn" mutex_integer = "warn" -needless_continue = "warn" +needless_continue = "allow" needless_for_each = "warn" negative_feature_names = "warn" path_buf_push_overwrite = "warn" @@ -86,6 +87,15 @@ verbose_file_reads = "warn" wildcard_imports = "warn" zero_sized_map_values = "warn" +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" +codegen-units = 1 +lto = true +# debug = "line-tables-only" # requires Cargo 1.71 + [package] name = "predicates" version = "3.1.3" diff --git a/README.md b/README.md index 575dc0d..734e053 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,13 @@ For more information on using predicates, look at the ## License -`predicates-rs` is distributed under the terms of both the MIT license and the -Apache License (Version 2.0). +Licensed under either of * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or ) * MIT license ([LICENSE-MIT](LICENSE-MIT) or ) +at your option. + ## Credits Big thanks to [futures-rs](https://github.com/alexcrichton/futures-rs), whose diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 8ab9f61..64e8e0f 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -2,13 +2,9 @@ name = "predicates-core" version = "1.0.9" description = "An API for boolean-valued predicate functions." -authors = ["Nick Stevens "] -readme = "README.md" -repository = "https://github.com/assert-rs/predicates-rs/tree/master/crates/core" -homepage = "https://github.com/assert-rs/predicates-rs/tree/master/crates/core" -documentation = "https://docs.rs/predicates-core" categories = ["data-structures", "rust-patterns"] keywords = ["predicate", "boolean", "combinatorial", "match", "logic"] +repository.workspace = true license.workspace = true edition.workspace = true rust-version.workspace = true @@ -16,7 +12,7 @@ include.workspace = true [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] [package.metadata.release] pre-release-replacements = [ diff --git a/crates/core/README.md b/crates/core/README.md index 57ec3ac..a6951ce 100644 --- a/crates/core/README.md +++ b/crates/core/README.md @@ -12,11 +12,12 @@ ## License -`predicates-core` is distributed under the terms of both the MIT license and the -Apache License (Version 2.0). +Licensed under either of -See LICENSE-APACHE, and LICENSE-MIT for details. +* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or ) +* MIT license ([LICENSE-MIT](LICENSE-MIT) or ) +at your option. ## Credits diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 16a8a63..8e7a37b 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -24,3 +24,7 @@ mod core; pub use crate::core::*; pub mod reflection; + +#[doc = include_str!("../README.md")] +#[cfg(doctest)] +pub struct ReadmeDoctests; diff --git a/crates/tree/Cargo.toml b/crates/tree/Cargo.toml index e50884c..b560845 100644 --- a/crates/tree/Cargo.toml +++ b/crates/tree/Cargo.toml @@ -1,14 +1,10 @@ [package] name = "predicates-tree" version = "1.0.12" -authors = ["Nick Stevens "] description = "Render boolean-valued predicate functions results as a tree." -readme = "README.md" -repository = "https://github.com/assert-rs/predicates-rs/tree/master/crates/tree" -homepage = "https://github.com/assert-rs/predicates-rs/tree/master/crates/tree" -documentation = "https://docs.rs/predicates-tree" categories = ["data-structures", "rust-patterns"] keywords = ["predicate", "boolean", "combinatorial", "match", "logic"] +repository.workspace = true license.workspace = true edition.workspace = true rust-version.workspace = true @@ -16,7 +12,7 @@ include.workspace = true [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] [package.metadata.release] pre-release-replacements = [ diff --git a/crates/tree/README.md b/crates/tree/README.md index 4902db1..4125807 100644 --- a/crates/tree/README.md +++ b/crates/tree/README.md @@ -12,7 +12,9 @@ ## License -`predicates-tree` is distributed under the terms of both the MIT license and the -Apache License (Version 2.0). +Licensed under either of -See LICENSE-APACHE, and LICENSE-MIT for details. +* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or ) +* MIT license ([LICENSE-MIT](LICENSE-MIT) or ) + +at your option. diff --git a/crates/tree/src/lib.rs b/crates/tree/src/lib.rs index d3287a9..116a94b 100644 --- a/crates/tree/src/lib.rs +++ b/crates/tree/src/lib.rs @@ -85,3 +85,7 @@ impl fmt::Display for Displayable { } } } + +#[doc = include_str!("../README.md")] +#[cfg(doctest)] +pub struct ReadmeDoctests; diff --git a/deny.toml b/deny.toml index b6ecbe9..2982ba3 100644 --- a/deny.toml +++ b/deny.toml @@ -87,12 +87,14 @@ allow = [ "MIT", "MIT-0", "Apache-2.0", + "BSD-2-Clause", "BSD-3-Clause", "MPL-2.0", "Unicode-DFS-2016", "CC0-1.0", "ISC", "OpenSSL", + "Zlib", ] # The confidence threshold for detecting a license from license text. # The higher the value, the more closely the license text must be to the diff --git a/src/lib.rs b/src/lib.rs index 2c9b19b..43c809d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -227,3 +227,7 @@ pub mod str; mod color; use color::Palette; mod utils; + +#[doc = include_str!("../README.md")] +#[cfg(doctest)] +pub struct ReadmeDoctests; diff --git a/src/str/mod.rs b/src/str/mod.rs index 0d0dffd..254656c 100644 --- a/src/str/mod.rs +++ b/src/str/mod.rs @@ -27,4 +27,4 @@ pub use self::normalize::NormalizedPredicate; #[cfg(feature = "regex")] mod regex; #[cfg(feature = "regex")] -pub use self::regex::{is_match, RegexError, RegexPredicate}; +pub use self::regex::{is_match, RegexError, RegexMatchesPredicate, RegexPredicate};