diff --git a/git-cliff-core/src/repo.rs b/git-cliff-core/src/repo.rs index 1a9da2f595..da7fc731df 100644 --- a/git-cliff-core/src/repo.rs +++ b/git-cliff-core/src/repo.rs @@ -109,18 +109,17 @@ impl Repository { } /// Returns the tag object of the given name. - /// if given name don't exists, still returns Tag object with the given name + /// + /// If given name doesn't exist, it still returns `Tag` with the given name. pub fn resolve_tag(&self, name: &str) -> Tag { - match self.inner.resolve_reference_from_short_name(name) { - Ok(reference) => match reference.peel_to_tag() { - Ok(tag) => Tag { - name: tag.name().unwrap_or_default().to_owned(), - message: tag.message().map(Self::cleanup_message), - }, - _ => Tag { - name: name.to_owned(), - message: None, - }, + match self + .inner + .resolve_reference_from_short_name(name) + .and_then(|r| r.peel_to_tag()) + { + Ok(tag) => Tag { + name: tag.name().unwrap_or_default().to_owned(), + message: tag.message().map(Self::cleanup_message), }, _ => Tag { name: name.to_owned(), diff --git a/git-cliff-core/src/tag.rs b/git-cliff-core/src/tag.rs index 401a5d3d0f..7b6df49477 100644 --- a/git-cliff-core/src/tag.rs +++ b/git-cliff-core/src/tag.rs @@ -1,5 +1,6 @@ /// Common tag object that is parsed from a repository. -/// lightweight tag will have None at message. +/// +/// Lightweight tags will have `None` as message. #[derive(Debug)] pub struct Tag { /// The name of the tag