diff --git a/src/policy/capabilities.rs b/src/policy/capabilities.rs index 46db3a4..8d8f98a 100644 --- a/src/policy/capabilities.rs +++ b/src/policy/capabilities.rs @@ -3,7 +3,7 @@ use std::{fmt::Display, mem}; use flexstr::SharedStr; use serde::Serialize; -#[derive(Debug, Clone, Eq, PartialEq, Hash, Default, Serialize)] +#[derive(Debug, Clone, Eq, PartialEq, Hash, Default, Serialize, PartialOrd, Ord)] pub struct CapSet(Box<[SharedStr]>); impl CapSet { diff --git a/src/policy/mod.rs b/src/policy/mod.rs index 700b900..9a41d7c 100644 --- a/src/policy/mod.rs +++ b/src/policy/mod.rs @@ -263,7 +263,8 @@ impl Display for Action { write!(f, "!")?; } if let ActionType::Require(ref caps) = self.action { - let caps = Vec::from_iter(caps); + let mut caps = Vec::from_iter(caps); + caps.sort_unstable(); match caps.first() { Some(cap) => write!(f, " {}", cap)?, None => write!(f, " NOTHING")?,