Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Aug 15, 2024
1 parent 02326eb commit dcc744c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/helm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,25 @@ pub struct ImageRefs {
}

impl ImageRefs {
pub fn parse(repo: &Repository, diff_file: DiffFile) -> Result<Self, anyhow::Error> {
pub fn parse(repo: &Repository, diff_file: &DiffFile) -> Result<Self, anyhow::Error> {
let blob_id = diff_file.id();
let blob = repo
.find_blob(blob_id)
.with_context(|| format!("cannot find Git blob {blob_id}"))?;
Ok(serde_yml::from_slice(blob.content())
.with_context(|| format!("cannot parse yaml file {:?}", diff_file.path()))?)
serde_yml::from_slice(blob.content()).with_context(|| format!("cannot parse yaml file {:?}", diff_file.path()))
}
}

#[derive(Debug, Serialize, Deserialize)]
pub struct ImageRef {
pub account: String,
pub account: String,
pub repository: String,
pub tag: String,
pub sources: Vec<SourceRepoRef>,
pub tag: String,
pub sources: Vec<SourceRepoRef>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct SourceRepoRef {
pub repo: String,
pub repo: String,
pub commit: String,
}
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ fn find_values_yaml(workspace: String, base: &str, head: &str) -> Result<Vec<Rep
continue;
}

let new_image_refs = ImageRefs::parse(&repo, new_file)?;
let new_image_refs = ImageRefs::parse(&repo, &new_file)?;

let old_file = diff_delta.old_file();
if old_file.exists() {
let old_image_refs = ImageRefs::parse(&repo, old_file)?;
let old_image_refs = ImageRefs::parse(&repo, &old_file)?;

for (name, image) in &new_image_refs.container_images {
for source in &image.sources {
Expand Down

0 comments on commit dcc744c

Please sign in to comment.