diff --git a/src/buildpacks.rs b/src/buildpacks.rs index 44535ca5..5f9b78e4 100644 --- a/src/buildpacks.rs +++ b/src/buildpacks.rs @@ -12,17 +12,17 @@ pub(crate) enum CalculateDigestError { ExitStatus(String, ExitStatus), } -pub(crate) fn calculate_digest(digest_url: &String) -> Result { +pub(crate) fn calculate_digest(digest_url: &str) -> Result { let output = Command::new("crane") .args(["digest", digest_url]) .output() - .map_err(|e| CalculateDigestError::CommandFailure(digest_url.clone(), e))?; + .map_err(|e| CalculateDigestError::CommandFailure(digest_url.to_owned(), e))?; if output.status.success() { Ok(String::from_utf8_lossy(&output.stdout).trim().to_string()) } else { Err(CalculateDigestError::ExitStatus( - digest_url.clone(), + digest_url.to_owned(), output.status, )) } diff --git a/src/changelog.rs b/src/changelog.rs index bb667046..56726bd5 100644 --- a/src/changelog.rs +++ b/src/changelog.rs @@ -197,13 +197,13 @@ pub(crate) enum ChangelogError { pub(crate) fn generate_release_declarations>( changelog: &Changelog, repository: S, - starting_with_version: &Option, + starting_with_version: Option<&Version>, ) -> String { let repository = repository.into(); let mut versions = changelog.releases.values().filter_map(|release| { if let Some(starting_version) = &starting_with_version { - if starting_version.le(&release.version) { + if (*starting_version).le(&release.version) { Some(&release.version) } else { None @@ -394,7 +394,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 let declarations = generate_release_declarations( &changelog, "https://github.com/olivierlacan/keep-a-changelog", - &None, + None, ); assert_eq!( declarations, @@ -422,7 +422,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 let declarations = generate_release_declarations( &changelog, "https://github.com/olivierlacan/keep-a-changelog", - &None, + None, ); assert_eq!( declarations, @@ -438,7 +438,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 let declarations = generate_release_declarations( &changelog, "https://github.com/olivierlacan/keep-a-changelog", - &None, + None, ); assert_eq!( declarations, @@ -452,7 +452,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 let declarations = generate_release_declarations( &changelog, "https://github.com/olivierlacan/keep-a-changelog", - &Some(Version { + Some(&Version { major: 1, minor: 0, patch: 0, diff --git a/src/commands/prepare_release/command.rs b/src/commands/prepare_release/command.rs index c192aef7..e7e2bfaa 100644 --- a/src/commands/prepare_release/command.rs +++ b/src/commands/prepare_release/command.rs @@ -116,7 +116,7 @@ pub(crate) fn execute(args: PrepareReleaseArgs) -> Result<()> { let release_declarations = generate_release_declarations( &new_changelog, repository_url.to_string(), - &declarations_starting_version, + declarations_starting_version.as_ref(), ); let changelog_contents = format!("{new_changelog}\n{release_declarations}\n");