From 82c0194efd70816fb70c1a2c1e83ea9567e4081a Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 17 May 2023 16:40:41 +0200 Subject: [PATCH] pbs-config: clippy fixes Signed-off-by: Thomas Lamprecht --- pbs-config/src/acl.rs | 4 ++-- pbs-config/src/datastore.rs | 2 +- pbs-config/src/domains.rs | 2 +- pbs-config/src/drive.rs | 2 +- pbs-config/src/media_pool.rs | 2 +- pbs-config/src/prune.rs | 2 +- pbs-config/src/remote.rs | 2 +- pbs-config/src/sync.rs | 2 +- pbs-config/src/tape_job.rs | 2 +- pbs-config/src/traffic_control.rs | 2 +- pbs-config/src/user.rs | 2 +- pbs-config/src/verify.rs | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pbs-config/src/acl.rs b/pbs-config/src/acl.rs index 01a75c00..20269f5d 100644 --- a/pbs-config/src/acl.rs +++ b/pbs-config/src/acl.rs @@ -796,8 +796,8 @@ mod test { let path_vec = super::split_acl_path(path); let mut roles = tree .roles(auth_id, &path_vec) - .iter() - .map(|(v, _)| v.clone()) + .keys() + .cloned() .collect::>(); roles.sort(); let roles = roles.join(","); diff --git a/pbs-config/src/datastore.rs b/pbs-config/src/datastore.rs index 6cbff254..5844a174 100644 --- a/pbs-config/src/datastore.rs +++ b/pbs-config/src/datastore.rs @@ -58,7 +58,7 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { // shell completion helper pub fn complete_datastore_name(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/domains.rs b/pbs-config/src/domains.rs index 521bf206..35aa11d5 100644 --- a/pbs-config/src/domains.rs +++ b/pbs-config/src/domains.rs @@ -66,7 +66,7 @@ pub fn exists(domains: &SectionConfigData, realm: &str) -> bool { // shell completion helper pub fn complete_realm_name(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/drive.rs b/pbs-config/src/drive.rs index 2929b71f..67ffc554 100644 --- a/pbs-config/src/drive.rs +++ b/pbs-config/src/drive.rs @@ -100,7 +100,7 @@ pub fn check_drive_exists(config: &SectionConfigData, drive: &str) -> Result<(), /// List all drive names pub fn complete_drive_name(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/media_pool.rs b/pbs-config/src/media_pool.rs index 1b3e6632..3b6448c3 100644 --- a/pbs-config/src/media_pool.rs +++ b/pbs-config/src/media_pool.rs @@ -67,7 +67,7 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { /// List existing pool names pub fn complete_pool_name(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/prune.rs b/pbs-config/src/prune.rs index f88292dd..21e52ffc 100644 --- a/pbs-config/src/prune.rs +++ b/pbs-config/src/prune.rs @@ -51,7 +51,7 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { // shell completion helper pub fn complete_prune_job_id(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/remote.rs b/pbs-config/src/remote.rs index 024c27f5..9cbd1321 100644 --- a/pbs-config/src/remote.rs +++ b/pbs-config/src/remote.rs @@ -53,7 +53,7 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { // shell completion helper pub fn complete_remote_name(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/sync.rs b/pbs-config/src/sync.rs index 91bf1d03..6d27c123 100644 --- a/pbs-config/src/sync.rs +++ b/pbs-config/src/sync.rs @@ -52,7 +52,7 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { // shell completion helper pub fn complete_sync_job_id(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/tape_job.rs b/pbs-config/src/tape_job.rs index 5ec86fa3..75ace6c7 100644 --- a/pbs-config/src/tape_job.rs +++ b/pbs-config/src/tape_job.rs @@ -54,7 +54,7 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { /// List all tape job IDs pub fn complete_tape_job_id(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/traffic_control.rs b/pbs-config/src/traffic_control.rs index d8bee363..0826be83 100644 --- a/pbs-config/src/traffic_control.rs +++ b/pbs-config/src/traffic_control.rs @@ -67,7 +67,7 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { // shell completion helper pub fn complete_traffic_control_name(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } } diff --git a/pbs-config/src/user.rs b/pbs-config/src/user.rs index 4584cb08..8e10a778 100644 --- a/pbs-config/src/user.rs +++ b/pbs-config/src/user.rs @@ -164,7 +164,7 @@ pub fn complete_userid(_arg: &str, _param: &HashMap) -> Vec) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => vec![], } } diff --git a/pbs-config/src/verify.rs b/pbs-config/src/verify.rs index b0d3babc..2631eeef 100644 --- a/pbs-config/src/verify.rs +++ b/pbs-config/src/verify.rs @@ -56,7 +56,7 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> { // shell completion helper pub fn complete_verification_job_id(_arg: &str, _param: &HashMap) -> Vec { match config() { - Ok((data, _digest)) => data.sections.iter().map(|(id, _)| id.to_string()).collect(), + Ok((data, _digest)) => data.sections.keys().map(|id| id.to_string()).collect(), Err(_) => Vec::new(), } }