Skip to content

Commit

Permalink
Fix some clippy warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Bond_009 <[email protected]>
  • Loading branch information
Bond-009 committed Nov 20, 2024
1 parent 6b4d62c commit 8854dbe
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
12 changes: 3 additions & 9 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,13 @@ impl ImageRef {
let vars: HashMap<&'a str, &'a str> = HashMap::from_iter(
dockerfile.global_args
.iter()
.filter_map(|a| match a.value.as_ref() {
Some(v) => Some((a.name.as_ref(), v.as_ref())),
None => None
})
.filter_map(|a| a.value.as_ref().map(|v| (a.name.as_ref(), v.as_ref())))
);

let mut used_vars = HashSet::new();

if let Some(s) = substitute(&self.to_string(), &vars, &mut used_vars, 16) {
Some((ImageRef::parse(&s), used_vars))
} else {
None
}
substitute(&self.to_string(), &vars, &mut used_vars, 16)
.map(|s| (ImageRef::parse(&s), used_vars))
}

/// Given a Dockerfile (and its global `ARG`s), perform any necessary
Expand Down
2 changes: 1 addition & 1 deletion src/instructions/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl EnvVar {
pub fn new(span: Span, key: SpannedString, value: impl Into<BreakableString>) -> Self {
EnvVar {
span,
key: key,
key,
value: value.into(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/instructions/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl FromInstruction {
});
};

let image_parsed = ImageRef::parse(&image.as_ref());
let image_parsed = ImageRef::parse(image.as_ref());

if let Some(hash) = &image_parsed.hash {
let parts: Vec<&str> = hash.split(":").collect();
Expand Down
2 changes: 1 addition & 1 deletion src/splicer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl From<(usize, usize)> for Span {

impl From<&Pair<'_>> for Span {
fn from(pair: &Pair<'_>) -> Self {
Span::from_pair(&pair)
Span::from_pair(pair)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<'a> Ord for Stage<'a> {

impl<'a> PartialOrd for Stage<'a> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(&other))
Some(self.cmp(other))
}
}

Expand Down

0 comments on commit 8854dbe

Please sign in to comment.