Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
colincasey committed Dec 5, 2024
1 parent e26ec03 commit fde08d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/buildpacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ pub(crate) enum CalculateDigestError {
ExitStatus(String, ExitStatus),
}

pub(crate) fn calculate_digest(digest_url: &String) -> Result<String, CalculateDigestError> {
pub(crate) fn calculate_digest(digest_url: &str) -> Result<String, CalculateDigestError> {
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,
))
}
Expand Down
12 changes: 6 additions & 6 deletions src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ pub(crate) enum ChangelogError {
pub(crate) fn generate_release_declarations<S: Into<String>>(
changelog: &Changelog,
repository: S,
starting_with_version: &Option<Version>,
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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/prepare_release/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit fde08d5

Please sign in to comment.