diff --git a/.clippy.toml b/.clippy.toml index fc3ef79..23bf481 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1 +1 @@ -msrv = "1.54.0" # MSRV +msrv = "1.60.0" # MSRV diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c29adc3..25895f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: - name: No-default features run: cargo test --workspace --no-default-features msrv: - name: "Check MSRV: 1.54.0" + name: "Check MSRV: 1.60.0" runs-on: ubuntu-latest steps: - name: Checkout repository @@ -59,7 +59,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.54.0 # MSRV + toolchain: 1.60.0 # MSRV profile: minimal override: true - uses: Swatinem/rust-cache@v1 @@ -113,7 +113,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.54.0 # MSRV + toolchain: 1.60.0 # MSRV profile: minimal override: true components: clippy diff --git a/.github/workflows/rust-next.yml b/.github/workflows/rust-next.yml index af71a19..686049b 100644 --- a/.github/workflows/rust-next.yml +++ b/.github/workflows/rust-next.yml @@ -57,9 +57,9 @@ jobs: strategy: matrix: rust: - - 1.54.0 # MSRV + - 1.60.0 # MSRV - stable - continue-on-error: ${{ matrix.rust != '1.54.0' }} # MSRV + continue-on-error: ${{ matrix.rust != '1.60.0' }} # MSRV runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/Cargo.toml b/Cargo.toml index 1dda38f..c09bd33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,8 @@ documentation = "https://docs.rs/predicates" readme = "README.md" categories = ["data-structures", "rust-patterns"] keywords = ["predicate", "boolean", "combinatorial", "match", "logic"] -edition = "2018" +edition = "2021" +rust-version = "1.60.0" # MSRV include = [ "src/**/*", "Cargo.toml", @@ -40,15 +41,15 @@ normalize-line-endings = { version = "0.3.0", optional = true } regex = { version="1.0", optional = true } float-cmp = { version="0.9", optional = true } itertools = "0.10" -yansi = { version = "0.5.0", optional = true } -concolor = { version = "0.0.8", optional = true } +yansi = { version = "0.5.1", optional = true } +concolor = { version = "0.0.9", optional = true } [dev-dependencies] predicates-tree = { version = "1.0", path = "crates/tree" } [features] default = ["diff", "regex", "float-cmp", "normalize-line-endings"] -diff = ["difflib"] +diff = ["dep:difflib"] unstable = [] -color = ["yansi", "concolor/std"] -color-auto = ["color", "concolor/auto"] +color = ["dep:yansi", "dep:concolor", "concolor?/std"] +color-auto = ["color", "concolor?/auto"] diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 3c69aea..61c7064 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -10,7 +10,8 @@ homepage = "https://github.com/assert-rs/predicates-rs/tree/master/predicates-co documentation = "https://docs.rs/predicates-core" categories = ["data-structures", "rust-patterns"] keywords = ["predicate", "boolean", "combinatorial", "match", "logic"] -edition = "2018" +edition = "2021" +rust-version = "1.60.0" # MSRV include = [ "src/**/*", "Cargo.toml", diff --git a/crates/core/src/reflection.rs b/crates/core/src/reflection.rs index 7393c48..120d1bd 100644 --- a/crates/core/src/reflection.rs +++ b/crates/core/src/reflection.rs @@ -40,7 +40,7 @@ pub struct Parameter<'a>(&'a str, &'a dyn fmt::Display); impl<'a> Parameter<'a> { /// Create a new `Parameter`. pub fn new(key: &'a str, value: &'a dyn fmt::Display) -> Self { - Self { 0: key, 1: value } + Self(key, value) } /// Access the `Parameter` name. @@ -72,7 +72,7 @@ pub struct Child<'a>(&'a str, &'a dyn PredicateReflection); impl<'a> Child<'a> { /// Create a new `Predicate` child. pub fn new(key: &'a str, value: &'a dyn PredicateReflection) -> Self { - Self { 0: key, 1: value } + Self(key, value) } /// Access the `Child`'s name. @@ -141,16 +141,12 @@ impl<'a> Case<'a> { /// Access the by-products from determining this case. pub fn products(&self) -> CaseProducts<'_> { - CaseProducts { - 0: self.products.iter(), - } + CaseProducts(self.products.iter()) } /// Access the sub-cases. pub fn children(&self) -> CaseChildren<'_> { - CaseChildren { - 0: self.children.iter(), - } + CaseChildren(self.children.iter()) } } @@ -229,10 +225,7 @@ impl Product { S: Into>, D: fmt::Display + 'static, { - Self { - 0: key.into(), - 1: Box::new(value), - } + Self(key.into(), Box::new(value)) } /// Access the `Product` name. @@ -246,13 +239,13 @@ impl Product { } } -impl<'a> fmt::Display for Product { +impl fmt::Display for Product { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}: {}", self.0, self.1) } } -impl<'a> fmt::Debug for Product { +impl fmt::Debug for Product { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "({:?}, {})", self.0, self.1) } diff --git a/crates/tree/Cargo.toml b/crates/tree/Cargo.toml index 4ad94c1..f74fbbf 100644 --- a/crates/tree/Cargo.toml +++ b/crates/tree/Cargo.toml @@ -10,7 +10,8 @@ homepage = "https://github.com/assert-rs/predicates-rs/tree/master/predicates-tr documentation = "https://docs.rs/predicates-tree" categories = ["data-structures", "rust-patterns"] keywords = ["predicate", "boolean", "combinatorial", "match", "logic"] -edition = "2018" +edition = "2021" +rust-version = "1.60.0" # MSRV include = [ "src/**/*", "Cargo.toml", diff --git a/crates/tree/src/lib.rs b/crates/tree/src/lib.rs index 1f0f1e5..dc33e17 100644 --- a/crates/tree/src/lib.rs +++ b/crates/tree/src/lib.rs @@ -41,7 +41,7 @@ fn convert(case: &reflection::Case<'_>) -> CaseTreeInner { termtree::Tree::new(root).with_multiline(true) })); - leaves.extend(case.children().map(|item| convert(item))); + leaves.extend(case.children().map(convert)); let root = Box::new(case.predicate().map(|p| p.to_string()).unwrap_or_default()); CaseTreeInner::new(root).with_leaves(leaves)