diff --git a/crates/config/src/sections/passwords.rs b/crates/config/src/sections/passwords.rs index 981565727..6296f2841 100644 --- a/crates/config/src/sections/passwords.rs +++ b/crates/config/src/sections/passwords.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::cmp::Reverse; + use anyhow::bail; use camino::Utf8PathBuf; use schemars::JsonSchema; @@ -104,9 +106,8 @@ impl PasswordsConfig { &self, ) -> Result, Option>)>, anyhow::Error> { let mut schemes: Vec<&HashingScheme> = self.schemes.iter().collect(); - schemes.sort_unstable_by_key(|a| a.version); + schemes.sort_unstable_by_key(|a| Reverse(a.version)); schemes.dedup_by_key(|a| a.version); - schemes.reverse(); if schemes.len() != self.schemes.len() { // Some schemes had duplicated versions