[pbs-devel] [PATCH proxmox-backup 02/12] tape/changer: clippy fixes
Dominik Csapak
d.csapak at proxmox.com
Tue Apr 6 08:27:37 CEST 2021
fixes:
* unnecessary referencing
* `.map(|v| *v)` => `.copied()`
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/tape/changer/online_status_map.rs | 4 ++--
src/tape/changer/sg_pt_changer.rs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/tape/changer/online_status_map.rs b/src/tape/changer/online_status_map.rs
index e30cd17b..324d1fec 100644
--- a/src/tape/changer/online_status_map.rs
+++ b/src/tape/changer/online_status_map.rs
@@ -137,7 +137,7 @@ pub fn update_online_status(state_path: &Path, changer: Option<&str>) -> Result<
for mut changer_config in changers {
if let Some(changer) = changer {
- if changer != &changer_config.name {
+ if changer != changer_config.name {
continue;
}
found_changer = true;
@@ -157,7 +157,7 @@ pub fn update_online_status(state_path: &Path, changer: Option<&str>) -> Result<
let vtapes: Vec<VirtualTapeDrive> = config.convert_to_typed_array("virtual")?;
for mut vtape in vtapes {
if let Some(changer) = changer {
- if changer != &vtape.name {
+ if changer != vtape.name {
continue;
}
found_changer = true;
diff --git a/src/tape/changer/sg_pt_changer.rs b/src/tape/changer/sg_pt_changer.rs
index 785fc9ce..b559653c 100644
--- a/src/tape/changer/sg_pt_changer.rs
+++ b/src/tape/changer/sg_pt_changer.rs
@@ -392,7 +392,7 @@ pub fn read_element_status<F: AsRawFd>(file: &mut F) -> Result<MtxStatus, Error>
for drive in status.drives.iter_mut() {
if let Some(source_address) = drive.loaded_slot {
let source_address = source_address as u16;
- drive.loaded_slot = slot_map.get(&source_address).map(|v| *v);
+ drive.loaded_slot = slot_map.get(&source_address).copied();
}
}
--
2.20.1
More information about the pbs-devel
mailing list