tree-wide: fix needless borrows
found and fixed via clippy Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
@ -265,9 +265,9 @@ impl ScsiMediaChange for ScsiTapeChanger {
|
||||
}
|
||||
|
||||
let status = if USE_MTX {
|
||||
mtx::mtx_status(&self)
|
||||
mtx::mtx_status(self)
|
||||
} else {
|
||||
sg_pt_changer::status(&self)
|
||||
sg_pt_changer::status(self)
|
||||
};
|
||||
|
||||
match &status {
|
||||
|
@ -21,7 +21,7 @@ pub fn mtx_status(config: &ScsiTapeChanger) -> Result<MtxStatus, Error> {
|
||||
|
||||
let mut status = parse_mtx_status(&output)?;
|
||||
|
||||
status.mark_import_export_slots(&config)?;
|
||||
status.mark_import_export_slots(config)?;
|
||||
|
||||
Ok(status)
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ Data Transfer Element 1:Empty
|
||||
Storage Element 24 IMPORT/EXPORT:Empty
|
||||
"###;
|
||||
|
||||
let _ = parse_mtx_status(&output)?;
|
||||
let _ = parse_mtx_status(output)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -192,11 +192,11 @@ pub fn update_changer_online_status(
|
||||
let mut online_map = OnlineStatusMap::new(drive_config)?;
|
||||
let mut online_set = HashSet::new();
|
||||
for label_text in label_text_list.iter() {
|
||||
if let Some(media_id) = inventory.find_media_by_label_text(&label_text) {
|
||||
if let Some(media_id) = inventory.find_media_by_label_text(label_text) {
|
||||
online_set.insert(media_id.label.uuid.clone());
|
||||
}
|
||||
}
|
||||
online_map.update_online_status(&changer_name, online_set)?;
|
||||
online_map.update_online_status(changer_name, online_set)?;
|
||||
inventory.update_online_status(&online_map)?;
|
||||
|
||||
Ok(())
|
||||
|
@ -827,7 +827,7 @@ pub fn complete_media_set_snapshots(_arg: &str, param: &HashMap<String, String>)
|
||||
None => return Vec::new(),
|
||||
};
|
||||
let status_path = Path::new(TAPE_STATUS_DIR);
|
||||
let inventory = match Inventory::load(&status_path) {
|
||||
let inventory = match Inventory::load(status_path) {
|
||||
Ok(inventory) => inventory,
|
||||
Err(_) => return Vec::new(),
|
||||
};
|
||||
|
@ -413,7 +413,7 @@ impl MediaCatalog {
|
||||
|
||||
let uuid = &media_id.label.uuid;
|
||||
|
||||
let me = Self::create_temporary_database(base_path, &media_id, log_to_stdout)?;
|
||||
let me = Self::create_temporary_database(base_path, media_id, log_to_stdout)?;
|
||||
|
||||
Self::finish_temporary_database(base_path, uuid, true)?;
|
||||
|
||||
|
@ -289,7 +289,7 @@ impl MediaPool {
|
||||
create_new_set = Some(String::from("policy is AlwaysCreate"));
|
||||
}
|
||||
MediaSetPolicy::CreateAt(event) => {
|
||||
if let Some(set_start_time) = self.inventory.media_set_start_time(&self.current_media_set.uuid()) {
|
||||
if let Some(set_start_time) = self.inventory.media_set_start_time(self.current_media_set.uuid()) {
|
||||
if let Ok(Some(alloc_time)) = event.compute_next_event(set_start_time as i64) {
|
||||
if current_time >= alloc_time {
|
||||
create_new_set = Some(String::from("policy CreateAt event triggered"));
|
||||
@ -407,7 +407,7 @@ impl MediaPool {
|
||||
|
||||
for media_id in media_list {
|
||||
|
||||
let (status, location) = self.compute_media_state(&media_id);
|
||||
let (status, location) = self.compute_media_state(media_id);
|
||||
if media_id.media_set_label.is_some() { continue; } // should not happen
|
||||
|
||||
if !self.location_is_available(&location) {
|
||||
@ -478,7 +478,7 @@ impl MediaPool {
|
||||
continue;
|
||||
}
|
||||
|
||||
if !self.media_is_expired(&media, current_time) {
|
||||
if !self.media_is_expired(media, current_time) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ impl CatalogSet {
|
||||
}
|
||||
|
||||
// remove read-only version from set (in case it is there)
|
||||
self.media_set_catalog.remove_catalog(&new_catalog.uuid());
|
||||
self.media_set_catalog.remove_catalog(new_catalog.uuid());
|
||||
|
||||
self.catalog = Some(new_catalog);
|
||||
|
||||
|
@ -117,7 +117,7 @@ impl PoolWriter {
|
||||
|
||||
/// Set media status to FULL (persistent - stores pool status)
|
||||
pub fn set_media_status_full(&mut self, uuid: &Uuid) -> Result<(), Error> {
|
||||
self.pool.set_media_status_full(&uuid)?;
|
||||
self.pool.set_media_status_full(uuid)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -556,7 +556,7 @@ fn write_chunk_archive<'a>(
|
||||
|
||||
//println!("CHUNK {} size {}", hex::encode(digest), blob.raw_size());
|
||||
|
||||
match writer.try_write_chunk(&digest, &blob) {
|
||||
match writer.try_write_chunk(digest, blob) {
|
||||
Ok(true) => {
|
||||
chunk_list.push(*digest);
|
||||
chunk_iter.next(); // consume
|
||||
@ -627,7 +627,7 @@ fn update_media_set_label(
|
||||
if new_set.encryption_key_fingerprint != media_set_label.encryption_key_fingerprint {
|
||||
bail!("detected changed encryption fingerprint - internal error");
|
||||
}
|
||||
media_catalog = MediaCatalog::open(status_path, &media_id, true, false)?;
|
||||
media_catalog = MediaCatalog::open(status_path, media_id, true, false)?;
|
||||
|
||||
// todo: verify last content/media_catalog somehow?
|
||||
|
||||
|
@ -53,7 +53,7 @@ impl NewChunksIterator {
|
||||
continue;
|
||||
}
|
||||
|
||||
if catalog_set.lock().unwrap().contains_chunk(&datastore_name, &digest) {
|
||||
if catalog_set.lock().unwrap().contains_chunk(datastore_name, &digest) {
|
||||
continue;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user