1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-09-11 06:55:38 +03:00

refactor(clippy): apply clippy suggestions

This commit is contained in:
Orhun Parmaksız 2024-03-10 10:31:36 +01:00
parent 45c87f2f30
commit 72c1fa342f
No known key found for this signature in database
GPG Key ID: F83424824B3E4B90

View File

@ -384,7 +384,7 @@ pub fn run(mut args: Opt) -> Result<()> {
}
}
if args.body.is_some() {
config.changelog.body = args.body.clone();
config.changelog.body.clone_from(&args.body);
}
if args.sort == Sort::Oldest {
if let Some(ref sort_commits) = config.git.sort_commits {
@ -398,7 +398,7 @@ pub fn run(mut args: Opt) -> Result<()> {
}
}
if args.github_token.is_some() {
config.remote.github.token = args.github_token.clone();
config.remote.github.token.clone_from(&args.github_token);
}
if let Some(ref remote) = args.github_repo {
config.remote.github.owner = remote.0.owner.to_string();
@ -418,7 +418,7 @@ pub fn run(mut args: Opt) -> Result<()> {
}
config.git.skip_tags = config.git.skip_tags.filter(|r| !r.as_str().is_empty());
if args.tag_pattern.is_some() {
config.git.tag_pattern = args.tag_pattern.clone();
config.git.tag_pattern.clone_from(&args.tag_pattern);
}
// Process the repositories.
@ -466,12 +466,8 @@ pub fn run(mut args: Opt) -> Result<()> {
if args.bump || args.bumped_version {
let next_version = if let Some(next_version) = changelog.bump_version()? {
next_version
} else if let Some(last_version) = changelog
.releases
.iter()
.next()
.cloned()
.and_then(|v| v.version)
} else if let Some(last_version) =
changelog.releases.first().cloned().and_then(|v| v.version)
{
warn!("There is nothing to bump.");
last_version