Skip to content

Commit

Permalink
Avoid clone
Browse files Browse the repository at this point in the history
  • Loading branch information
alpeb committed Jul 22, 2024
1 parent 2f39f2b commit dd2c9fa
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions policy-controller/src/admission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,10 @@ impl Validate<ServerSpec> for Admission {
}
}

if let Some(Err(_)) = spec
.clone()
.access_policy
.map(|p| p.parse::<index::DefaultPolicy>())
{
bail!("Invalid accessPolicy \"{}\"", spec.access_policy.unwrap());
if let Some(policy) = spec.access_policy {
policy
.parse::<index::DefaultPolicy>()
.map_err(|err| anyhow!("Invalid 'accessPolicy' field: {err}"))?;
}

Ok(())
Expand Down

0 comments on commit dd2c9fa

Please sign in to comment.