Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:

- name: Check out repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Generate Cargo.lock
run: cargo generate-lockfile
Expand All @@ -41,11 +43,11 @@ jobs:
shared-key: ${{ github.workflow }}-${{ github.job }}

- name: Detect code style issues (push)
uses: pre-commit/action@v3.0.0
uses: pre-commit/action@v3.0.1
if: github.event_name == 'push'

- name: Detect code style issues (pull_request)
uses: pre-commit/action@v3.0.0
uses: pre-commit/action@v3.0.1
if: github.event_name == 'pull_request'
env:
SKIP: no-commit-to-branch
7 changes: 6 additions & 1 deletion .github/workflows/security-audit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ jobs:
# has been resolved.
- uses: dtolnay/rust-toolchain@stable

- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main

- name: Install cargo-audit
run: cargo install cargo-audit
run: cargo binstall cargo-audit

- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
default_stages:
# Prevent that hooks run twice, triggered by both
# the Git commit-msg and the pre-commit hook.
- commit
- pre-commit

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -25,17 +25,17 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.16.0
rev: v9.22.0
hooks:
- id: commitlint
stages:
- commit-msg
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.13.0
rev: v0.17.2
hooks:
- id: markdownlint-cli2
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
args: [--ignore-words=.codespellignore]
Expand All @@ -48,7 +48,7 @@ repos:
- yaml
# https://reuse.software
- repo: https://github.com/fsfe/reuse-tool
rev: v4.0.3
rev: v5.0.2
hooks:
- id: reuse
- repo: https://github.com/doublify/pre-commit-rust
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ readme = "README.md"
authors = ["slowtec GmbH <post@slowtec.de>", "Uwe Klotz <uwe.klotz@gmail.com>"]
repository = "https://github.com/slowtec/semval"
categories = ["no-std", "rust-patterns"]
edition = "2021"
edition = "2024"
include = ["CHANGELOG.md", "README.md", "LICENSES/", "src/"]

[dependencies]
smallvec = { version = "1.13.1", features = ["union"] }
smallvec = { version = "1.14.0", features = ["union"] }

[features]
default = ["std"]
Expand All @@ -27,6 +27,7 @@ let_underscore = "warn"
missing_debug_implementations = "warn"
rust_2018_idioms = "warn"
rust_2021_compatibility = "warn"
rust_2024_compatibility = "warn"
unreachable_pub = "warn"
unsafe_code = "warn"
unused = "warn"
Expand Down
8 changes: 2 additions & 6 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
use core::iter::once;

use crate::{
Invalidity, Validate, ValidationResult,
smallvec::SmallVec,
util::{IsEmpty, Mergeable, MergeableSized},
Invalidity, Validate, ValidationResult,
};

const SMALLVEC_ARRAY_LEN: usize = 8;
Expand Down Expand Up @@ -162,11 +162,7 @@ where
/// validations failed.
#[inline]
pub fn into_result(self) -> ValidationResult<V> {
if self.is_valid() {
Ok(())
} else {
Err(self)
}
if self.is_valid() { Ok(()) } else { Err(self) }
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use self::util::UnitResult;
/// A proposed set of imports to ease usage of this crate.
pub mod prelude {
pub use super::{
context::Context as ValidationContext, IntoValidated, Invalidity, IsValid, Validate,
Validated, ValidatedFrom, ValidatedResult, ValidationResult,
IntoValidated, Invalidity, IsValid, Validate, Validated, ValidatedFrom, ValidatedResult,
ValidationResult, context::Context as ValidationContext,
};
}

Expand Down Expand Up @@ -96,7 +96,7 @@ where

/// `Validate` is implemented for any reference of a type
/// that implements `Validate`.
impl<'a, V> Validate for &'a V
impl<V> Validate for &V
where
V: Validate + ?Sized,
{
Expand All @@ -119,7 +119,7 @@ where
type Invalidity = V::Invalidity;

fn validate(&self) -> ValidationResult<Self::Invalidity> {
if let Some(ref some) = self {
if let Some(some) = self {
some.validate()
} else {
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl IsEmpty for usize {
}

///////////////////////////////////////////////////////////////////////////////
/// Mergeable
// Mergeable
///////////////////////////////////////////////////////////////////////////////

/// A monoid for collecting or accumulating items
Expand Down
Loading