Skip to content

Commit

Permalink
Merge pull request #391 from crate-ci/renovate/derive_more-1.x
Browse files Browse the repository at this point in the history
chore(deps): Update Rust crate derive_more to v1
  • Loading branch information
epage authored Sep 3, 2024
2 parents 15aca34 + 5678719 commit c982cc9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 51 deletions.
51 changes: 22 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resolver = "2"
repository = "https://github.com/crate-ci/committed"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.74" # MSRV
rust-version = "1.75" # MSRV
include = [
"build.rs",
"src/**/*",
Expand Down
2 changes: 1 addition & 1 deletion crates/committed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ clap-verbosity-flag = "2.2"
colorchoice-clap = "1.0.3"
grep-cli = "0.1"
imperative = "1.0.5"
derive_more = "0.99.17"
derive_more = { version = "1.0.0", features = ["from", "display"] }
itertools = "0.13.0"
proc-exit = "2.0"
human-panic = "2.0.0"
Expand Down
33 changes: 13 additions & 20 deletions crates/committed/src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub(crate) enum Source<'s> {
#[serde(serialize_with = "serialize_oid")]
Oid(git2::Oid),
ShortId(&'s str),
#[display(fmt = "{}", "_0.display()")]
#[display("{}", "_0.display()")]
Path(&'s std::path::Path),
}

Expand All @@ -47,7 +47,7 @@ where
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub(crate) enum Severity {
#[display(fmt = "error")]
#[display("error")]
Error,
}

Expand All @@ -73,7 +73,7 @@ pub(crate) enum Content<'s> {
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(
fmt = "Commit subject is too long, {} exceeds the max length of {}",
"Commit subject is too long, {} exceeds the max length of {}",
actual_length,
max_length
)]
Expand All @@ -86,7 +86,7 @@ pub(crate) struct SubjectTooLong {
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(
fmt = "Line is too long, {} exceeds the max length of {}",
"Line is too long, {} exceeds the max length of {}",
actual_length,
max_length
)]
Expand All @@ -98,46 +98,43 @@ pub(crate) struct LineTooLong {
#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(fmt = "Subject should be capitalized but found `{}`", first_word)]
#[display("Subject should be capitalized but found `{}`", first_word)]
pub(crate) struct CapitalizeSubject<'s> {
pub(crate) first_word: &'s str,
}

#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(fmt = "Subject should not be punctuated but found `{}`", punctuation)]
#[display("Subject should not be punctuated but found `{}`", punctuation)]
pub(crate) struct NoPunctuation {
pub(crate) punctuation: char,
}

#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(
fmt = "Subject should be in the imperative mood but found `{}`",
first_word
)]
#[display("Subject should be in the imperative mood but found `{}`", first_word)]
pub(crate) struct Imperative<'s> {
pub(crate) first_word: &'s str,
}

#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(fmt = "Work-in-progress commits must be cleaned up")]
#[display("Work-in-progress commits must be cleaned up")]
pub(crate) struct Wip {}

#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(fmt = "Fixup commits must be squashed")]
#[display("Fixup commits must be squashed")]
pub(crate) struct Fixup {}

#[derive(Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(fmt = "Commit is not in {} format: {}", style, error)]
#[display("Commit is not in {} format: {}", style, error)]
pub(crate) struct InvalidCommitFormat {
#[serde(serialize_with = "serialize_error")]
pub(crate) error: anyhow::Error,
Expand All @@ -155,11 +152,7 @@ where
#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(
fmt = "Disallowed type `{}` used, please use one of {:?}",
used,
allowed
)]
#[display("Disallowed type `{}` used, please use one of {:?}", used, allowed)]
pub(crate) struct DisallowedCommitType {
pub(crate) used: String,
pub(crate) allowed: Vec<String>,
Expand All @@ -168,13 +161,13 @@ pub(crate) struct DisallowedCommitType {
#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(fmt = "Merge commits are disallowed")]
#[display("Merge commits are disallowed")]
pub(crate) struct MergeCommitDisallowed {}

#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[derive(derive_more::Display)]
#[display(fmt = "Empty commits are disallowed")]
#[display("Empty commits are disallowed")]
pub(crate) struct EmptyCommit {}

pub(crate) type Report = fn(msg: Message<'_>);
Expand Down

0 comments on commit c982cc9

Please sign in to comment.