diff --git a/git-cliff-core/src/commit.rs b/git-cliff-core/src/commit.rs index 0697edc9e2..96a8c2d4e6 100644 --- a/git-cliff-core/src/commit.rs +++ b/git-cliff-core/src/commit.rs @@ -23,17 +23,20 @@ use lazy_regex::{ Regex, }; use serde::ser::{ - Serialize, SerializeStruct, Serializer, }; +use serde::{ + Deserialize, + Serialize, +}; /// Regular expression for matching SHA1 and a following commit message /// separated by a whitespace. static SHA1_REGEX: Lazy = lazy_regex!(r#"^\b([a-f0-9]{40})\b (.*)$"#); /// Object representing a link -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Link { /// Text of the link. @@ -43,7 +46,7 @@ pub struct Link { } /// A conventional commit footer. -#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] struct Footer<'a> { /// Token of the footer. /// @@ -72,9 +75,7 @@ impl<'a> From<&'a ConventionalFooter<'a>> for Footer<'a> { } /// Commit signature that indicates authorship. -#[derive( - Debug, Default, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, -)] +#[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] pub struct Signature { /// Name on the signature. pub name: Option, @@ -96,7 +97,7 @@ impl<'a> From> for Signature { } /// Common commit object that is parsed from a repository. -#[derive(Debug, Default, Clone, PartialEq, serde::Deserialize)] +#[derive(Debug, Default, Clone, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Commit<'a> { /// Commit ID. diff --git a/git-cliff-core/src/config.rs b/git-cliff-core/src/config.rs index 1f6a9b21e1..1502a47bcd 100644 --- a/git-cliff-core/src/config.rs +++ b/git-cliff-core/src/config.rs @@ -4,6 +4,10 @@ use regex::{ Regex, RegexBuilder, }; +use serde::{ + Deserialize, + Serialize, +}; use std::ffi::OsStr; use std::fs; use std::path::Path; @@ -16,7 +20,7 @@ const CARGO_METADATA_REGEX: &str = const PYPROJECT_METADATA_REGEX: &str = r"^\[(?:tool)\.git\-cliff\."; /// Configuration values. -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct Config { /// Configuration values about changelog generation. #[serde(default)] @@ -27,7 +31,7 @@ pub struct Config { } /// Changelog configuration. -#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct ChangelogConfig { /// Changelog header. pub header: Option, @@ -42,7 +46,7 @@ pub struct ChangelogConfig { } /// Git configuration -#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct GitConfig { /// Whether to enable parsing conventional commits. pub conventional_commits: Option, @@ -80,7 +84,7 @@ pub struct GitConfig { } /// Parser for grouping commits. -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct CommitParser { /// Regex for matching the commit message. #[serde(with = "serde_regex", default)] @@ -99,7 +103,7 @@ pub struct CommitParser { } /// TextProcessor, e.g. for modifying commit messages. -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TextProcessor { /// Regex for matching a text to replace. #[serde(with = "serde_regex")] @@ -130,7 +134,7 @@ impl TextProcessor { } /// Parser for extracting links in commits. -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct LinkParser { /// Regex for finding links in the commit message. #[serde(with = "serde_regex")] diff --git a/git-cliff-core/src/release.rs b/git-cliff-core/src/release.rs index 8b75731b93..f1964494af 100644 --- a/git-cliff-core/src/release.rs +++ b/git-cliff-core/src/release.rs @@ -1,8 +1,12 @@ use crate::commit::Commit; use crate::error::Result; +use serde::{ + Deserialize, + Serialize, +}; /// Representation of a release. -#[derive(Default, Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Release<'a> { /// Release version, git tag.