Skip to content

Commit

Permalink
chore: fix clippy warning
Browse files Browse the repository at this point in the history
Address new warning raised by latest version of clippy

Signed-off-by: Flavio Castelli <[email protected]>
  • Loading branch information
flavio committed Jan 14, 2025
1 parent b089388 commit 008d069
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@ fn validate(payload: &[u8]) -> CallResult {

fn has_allowed_privilege_escalation_container(containers: Vec<apicore::Container>) -> bool {
containers.into_iter().any(|container| {
container
.security_context
.map_or(false, |security_context| {
security_context.allow_privilege_escalation.unwrap_or(false)
})
container.security_context.is_some_and(|security_context| {
security_context.allow_privilege_escalation.unwrap_or(false)
})
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl kubewarden_policy_sdk::settings::Validatable for Settings {
#[cfg(test)]
mod tests {
use super::*;
use serde_yaml;


#[test]
fn test_policy_with_no_settings() -> Result<(), ()> {
Expand All @@ -48,7 +48,7 @@ mod tests {

let payload = "default_allow_privilege_escalation: false";
let settings = serde_yaml::from_str::<Settings>(payload)?;
assert_eq!(settings.default_allow_privilege_escalation, false);
assert!(!settings.default_allow_privilege_escalation);
Ok(())
}
}

0 comments on commit 008d069

Please sign in to comment.