Use BTreeMap::into_values

Stable under new MSRV.
This commit is contained in:
Jonas Platte 2022-01-20 13:13:14 +01:00
parent ff5fec9e74
commit 6bb1081b71
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
1 changed files with 11 additions and 9 deletions

View File

@ -531,11 +531,11 @@ impl Users {
prefix.push(0xff); prefix.push(0xff);
// Master key // Master key
let master_key_map = master_key let mut master_key_ids = master_key
.deserialize() .deserialize()
.map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Invalid master key"))? .map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Invalid master key"))?
.keys; .keys
let mut master_key_ids = master_key_map.values(); .into_values();
let master_key_id = master_key_ids.next().ok_or(Error::BadRequest( let master_key_id = master_key_ids.next().ok_or(Error::BadRequest(
ErrorKind::InvalidParam, ErrorKind::InvalidParam,
@ -560,13 +560,14 @@ impl Users {
// Self-signing key // Self-signing key
if let Some(self_signing_key) = self_signing_key { if let Some(self_signing_key) = self_signing_key {
let self_signing_key_map = self_signing_key let mut self_signing_key_ids = self_signing_key
.deserialize() .deserialize()
.map_err(|_| { .map_err(|_| {
Error::BadRequest(ErrorKind::InvalidParam, "Invalid self signing key") Error::BadRequest(ErrorKind::InvalidParam, "Invalid self signing key")
})? })?
.keys; .keys
let mut self_signing_key_ids = self_signing_key_map.values(); .into_values();
let self_signing_key_id = self_signing_key_ids.next().ok_or(Error::BadRequest( let self_signing_key_id = self_signing_key_ids.next().ok_or(Error::BadRequest(
ErrorKind::InvalidParam, ErrorKind::InvalidParam,
"Self signing key contained no key.", "Self signing key contained no key.",
@ -593,13 +594,14 @@ impl Users {
// User-signing key // User-signing key
if let Some(user_signing_key) = user_signing_key { if let Some(user_signing_key) = user_signing_key {
let user_signing_key_map = user_signing_key let mut user_signing_key_ids = user_signing_key
.deserialize() .deserialize()
.map_err(|_| { .map_err(|_| {
Error::BadRequest(ErrorKind::InvalidParam, "Invalid user signing key") Error::BadRequest(ErrorKind::InvalidParam, "Invalid user signing key")
})? })?
.keys; .keys
let mut user_signing_key_ids = user_signing_key_map.values(); .into_values();
let user_signing_key_id = user_signing_key_ids.next().ok_or(Error::BadRequest( let user_signing_key_id = user_signing_key_ids.next().ok_or(Error::BadRequest(
ErrorKind::InvalidParam, ErrorKind::InvalidParam,
"User signing key contained no key.", "User signing key contained no key.",