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:
@ -62,14 +62,14 @@ fn get_tape_handle(param: &Value) -> Result<SgTape, Error> {
|
||||
|
||||
if let Some(name) = param["drive"].as_str() {
|
||||
let (config, _digest) = pbs_config::drive::config()?;
|
||||
let drive: LtoTapeDrive = config.lookup("lto", &name)?;
|
||||
let drive: LtoTapeDrive = config.lookup("lto", name)?;
|
||||
eprintln!("using device {}", drive.path);
|
||||
return SgTape::new(open_lto_tape_device(&drive.path)?);
|
||||
}
|
||||
|
||||
if let Some(device) = param["device"].as_str() {
|
||||
eprintln!("using device {}", device);
|
||||
return SgTape::new(open_lto_tape_device(&device)?);
|
||||
return SgTape::new(open_lto_tape_device(device)?);
|
||||
}
|
||||
|
||||
if let Ok(name) = std::env::var("PROXMOX_TAPE_DRIVE") {
|
||||
@ -94,7 +94,7 @@ fn get_tape_handle(param: &Value) -> Result<SgTape, Error> {
|
||||
|
||||
if drive_names.len() == 1 {
|
||||
let name = drive_names[0];
|
||||
let drive: LtoTapeDrive = config.lookup("lto", &name)?;
|
||||
let drive: LtoTapeDrive = config.lookup("lto", name)?;
|
||||
eprintln!("using device {}", drive.path);
|
||||
return SgTape::new(open_lto_tape_device(&drive.path)?);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ fn get_changer_handle(param: &Value) -> Result<File, Error> {
|
||||
|
||||
if let Some(name) = param["changer"].as_str() {
|
||||
let (config, _digest) = pbs_config::drive::config()?;
|
||||
let changer_config: ScsiTapeChanger = config.lookup("changer", &name)?;
|
||||
let changer_config: ScsiTapeChanger = config.lookup("changer", name)?;
|
||||
eprintln!("using device {}", changer_config.path);
|
||||
return sg_pt_changer::open(&changer_config.path);
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ impl MtxStatus {
|
||||
let mut export_slots: HashSet<u64> = HashSet::new();
|
||||
|
||||
if let Some(slots) = &config.export_slots {
|
||||
let slots: Value = SLOT_ARRAY_SCHEMA.parse_property_string(&slots)?;
|
||||
let slots: Value = SLOT_ARRAY_SCHEMA.parse_property_string(slots)?;
|
||||
export_slots = slots
|
||||
.as_array()
|
||||
.unwrap()
|
||||
|
@ -86,7 +86,7 @@ fn execute_scsi_command<F: AsRawFd>(
|
||||
let mut timeout = std::time::Duration::new(5, 0); // short timeout by default
|
||||
|
||||
loop {
|
||||
match sg_raw.do_command(&cmd) {
|
||||
match sg_raw.do_command(cmd) {
|
||||
Ok(data) => return Ok(data.to_vec()),
|
||||
Err(err) if !retry => bail!("{} failed: {}", error_prefix, err),
|
||||
Err(err) => {
|
||||
@ -487,7 +487,7 @@ pub fn status(config: &ScsiTapeChanger) -> Result<MtxStatus, Error> {
|
||||
let mut status = read_element_status(&mut file)
|
||||
.map_err(|err| format_err!("error reading element status: {}", err))?;
|
||||
|
||||
status.mark_import_export_slots(&config)?;
|
||||
status.mark_import_export_slots(config)?;
|
||||
|
||||
Ok(status)
|
||||
}
|
||||
@ -827,7 +827,7 @@ mod test {
|
||||
element_type: u8,
|
||||
) -> Vec<u8> {
|
||||
let descs: Vec<Vec<u8>> = descriptors.iter().map(|desc| {
|
||||
build_storage_descriptor(&desc, trailing)
|
||||
build_storage_descriptor(desc, trailing)
|
||||
}).collect();
|
||||
|
||||
let (desc_len, address) = if let Some(el) = descs.get(0) {
|
||||
|
Reference in New Issue
Block a user