1
1
mirror of https://github.com/orhun/git-cliff.git synced 2025-01-05 22:54:48 +03:00

refactor(clippy): apply clippy suggestions

This commit is contained in:
Orhun Parmaksız 2021-12-31 21:27:52 +03:00
parent b88e7d30be
commit cd018e90a1
No known key found for this signature in database
GPG Key ID: B928720AEC532117
4 changed files with 4 additions and 9 deletions

View File

@ -197,10 +197,7 @@ impl Serialize for Commit<'_> {
commit.serialize_field("breaking", &conv.breaking())?;
commit.serialize_field(
"scope",
&conv
.scope()
.map(|v| v.as_str())
.or_else(|| self.scope.as_deref()),
&conv.scope().map(|v| v.as_str()).or(self.scope.as_deref()),
)?;
}
None => {

View File

@ -21,7 +21,7 @@ impl EmbeddedConfig {
/// Extracts the embedded content.
pub fn get_config() -> Result<String> {
match Self::get(crate::DEFAULT_CONFIG) {
Some(v) => Ok(str::from_utf8(&v.data.into_owned())?.to_string()),
Some(v) => Ok(str::from_utf8(&v.data)?.to_string()),
None => Err(Error::EmbeddedError(String::from(
"Embedded config not found",
))),

View File

@ -119,8 +119,7 @@ impl Repository {
if let Some(commit) = tag
.target()
.ok()
.map(|target| target.into_commit().ok())
.flatten()
.and_then(|target| target.into_commit().ok())
{
tags.push((commit, name));
}

View File

@ -56,8 +56,7 @@ pub fn run(mut args: Opt) -> Result<()> {
}?;
if let Some(config_path) = dirs_next::config_dir()
.map(|dir| dir.join(env!("CARGO_PKG_NAME")).join(DEFAULT_CONFIG))
.map(|path| path.to_str().map(String::from))
.flatten()
.and_then(|path| path.to_str().map(String::from))
{
if fs::metadata(&config_path).is_ok() {
path = config_path;