diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4534998..3feaf31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: rust: - stable - nightly - - 1.58.1 # MSRV + - 1.67.1 # MSRV steps: - uses: actions/checkout@v2 diff --git a/Cargo.toml b/Cargo.toml index 9ebccd0..007651d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ keywords = ["git", "log", "changelog", "parser", "parse"] license = "MIT" name = "clog" edition = "2021" -version = "0.10.0" -rust-version = "1.58.1" # MSRV +version = "0.11.0" +rust-version = "1.67.1" # MSRV authors = ["Christoph Burgdorf "] description = "A conventional changelog for the rest of us" exclude = ["docs/*"] diff --git a/src/fmt.rs b/src/fmt.rs index 14f8a16..f42b4de 100644 --- a/src/fmt.rs +++ b/src/fmt.rs @@ -8,17 +8,14 @@ use strum::{Display, EnumString}; pub use self::{json_writer::JsonWriter, md_writer::MarkdownWriter}; use crate::{clog::Clog, error::Result, sectionmap::SectionMap}; -#[derive(Copy, Clone, PartialEq, Eq, Debug, EnumString, Display)] +#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, EnumString, Display)] #[strum(ascii_case_insensitive)] pub enum ChangelogFormat { Json, + #[default] Markdown, } -impl Default for ChangelogFormat { - fn default() -> Self { ChangelogFormat::Markdown } -} - impl<'de> serde::de::Deserialize<'de> for ChangelogFormat { fn deserialize(deserializer: D) -> StdResult where diff --git a/src/link_style.rs b/src/link_style.rs index c7e3f15..13b05ab 100644 --- a/src/link_style.rs +++ b/src/link_style.rs @@ -12,19 +12,16 @@ use strum::{Display, EnumString}; /// let clog = Clog::new().unwrap(); /// clog.link_style(LinkStyle::Stash); /// ``` -#[derive(Debug, Copy, Clone, PartialEq, Eq, Display, EnumString)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Default, Display, EnumString)] #[strum(ascii_case_insensitive)] pub enum LinkStyle { + #[default] Github, Gitlab, Stash, Cgit, } -impl Default for LinkStyle { - fn default() -> Self { LinkStyle::Github } -} - impl<'de> serde::de::Deserialize<'de> for LinkStyle { fn deserialize(deserializer: D) -> Result where diff --git a/src/sectionmap.rs b/src/sectionmap.rs index 7380439..a12e050 100644 --- a/src/sectionmap.rs +++ b/src/sectionmap.rs @@ -46,15 +46,12 @@ impl SectionMap { let comp_map = sm .sections .entry("Breaking Changes".to_owned()) - .or_insert(BTreeMap::new()); - let sec_map = comp_map.entry(entry.component.clone()).or_insert(vec![]); + .or_default(); + let sec_map = comp_map.entry(entry.component.clone()).or_default(); sec_map.push(entry.clone()); } - let comp_map = sm - .sections - .entry(entry.commit_type.clone()) - .or_insert(BTreeMap::new()); - let sec_map = comp_map.entry(entry.component.clone()).or_insert(vec![]); + let comp_map = sm.sections.entry(entry.commit_type.clone()).or_default(); + let sec_map = comp_map.entry(entry.component.clone()).or_default(); sec_map.push(entry); }