From a375df6f4c48dde600f80b2ffea0a9666f7a980a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 19 Jan 2021 11:30:30 +0100 Subject: [PATCH] clippy: use copied/cloned instead of map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- src/bin/proxmox-backup-client.rs | 2 +- src/tape/inventory.rs | 2 +- src/tape/media_catalog.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index b5677cdb..2297d302 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -1466,7 +1466,7 @@ async fn prune_async(mut param: Value) -> Result { if quiet { let list: Vec = data.as_array().unwrap().iter().filter(|item| { item["keep"].as_bool() == Some(false) - }).map(|v| v.clone()).collect(); + }).cloned().collect(); data = list.into(); } diff --git a/src/tape/inventory.rs b/src/tape/inventory.rs index 17832c21..289ef510 100644 --- a/src/tape/inventory.rs +++ b/src/tape/inventory.rs @@ -300,7 +300,7 @@ impl Inventory { } pub fn media_set_start_time(&self, media_set_uuid: &Uuid) -> Option { - self.media_set_start_times.get(media_set_uuid).map(|t| *t) + self.media_set_start_times.get(media_set_uuid).copied() } /// Lookup media set pool diff --git a/src/tape/media_catalog.rs b/src/tape/media_catalog.rs index a3dd04db..d9cdf0ae 100644 --- a/src/tape/media_catalog.rs +++ b/src/tape/media_catalog.rs @@ -323,7 +323,7 @@ impl MediaCatalog { /// Returns the chunk archive file number pub fn lookup_snapshot(&self, snapshot: &str) -> Option { - self.snapshot_index.get(snapshot).map(|n| *n) + self.snapshot_index.get(snapshot).copied() } /// Test if the catalog already contain a chunk @@ -333,7 +333,7 @@ impl MediaCatalog { /// Returns the chunk archive file number pub fn lookup_chunk(&self, digest: &[u8;32]) -> Option { - self.chunk_index.get(digest).map(|n| *n) + self.chunk_index.get(digest).copied() } fn check_register_label(&self, file_number: u64) -> Result<(), Error> {