tree-wide: drop redundant clones
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
0a7f902e2a
commit
aa174e8e8a
@ -475,7 +475,7 @@ fn test_crypto_parameters_handling() -> Result<(), Error> {
|
||||
assert!(crypto_parameters(&json!({"keyfile": invalid_keypath, "crypt-mode": "encrypt"})).is_err());
|
||||
|
||||
// now set a default key
|
||||
unsafe { set_test_encryption_key(Ok(Some(default_key.clone()))); }
|
||||
unsafe { set_test_encryption_key(Ok(Some(default_key))); }
|
||||
|
||||
// and repeat
|
||||
|
||||
@ -550,7 +550,7 @@ fn test_crypto_parameters_handling() -> Result<(), Error> {
|
||||
// now remove default key again
|
||||
unsafe { set_test_encryption_key(Ok(None)); }
|
||||
// set a default master key
|
||||
unsafe { set_test_default_master_pubkey(Ok(Some(default_master_key.clone()))); }
|
||||
unsafe { set_test_default_master_pubkey(Ok(Some(default_master_key))); }
|
||||
|
||||
// and use an explicit master key
|
||||
assert!(crypto_parameters(&json!({"master-pubkey-file": master_keypath})).is_err());
|
||||
|
@ -177,7 +177,7 @@ pub fn insert_key(key: [u8;32], key_config: KeyConfig, force: bool) -> Result<()
|
||||
key_map.insert(fingerprint.clone(), item);
|
||||
save_keys(key_map)?;
|
||||
|
||||
config_map.insert(fingerprint.clone(), key_config);
|
||||
config_map.insert(fingerprint, key_config);
|
||||
save_key_configs(config_map)?;
|
||||
|
||||
Ok(())
|
||||
|
@ -167,7 +167,7 @@ async fn ensure_running(details: &SnapRestoreDetails) -> Result<VsockClient, Err
|
||||
Ok(VsockClient::new(
|
||||
new_cid,
|
||||
DEFAULT_VSOCK_PORT,
|
||||
Some(vms.ticket.clone()),
|
||||
Some(vms.ticket),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ impl WorkerTaskSetup {
|
||||
|
||||
fn new(basedir: PathBuf, file_opts: CreateOptions) -> Self {
|
||||
|
||||
let mut taskdir = basedir.clone();
|
||||
let mut taskdir = basedir;
|
||||
taskdir.push("tasks");
|
||||
|
||||
let mut task_lock_fn = taskdir.clone();
|
||||
@ -192,7 +192,7 @@ impl WorkerTaskSetup {
|
||||
let dir_opts = self.file_opts.clone()
|
||||
.perm(nix::sys::stat::Mode::from_bits_truncate(0o755));
|
||||
|
||||
create_path(&self.taskdir, Some(dir_opts.clone()), Some(dir_opts.clone()))?;
|
||||
create_path(&self.taskdir, Some(dir_opts.clone()), Some(dir_opts))?;
|
||||
// fixme:??? create_path(pbs_buildcfg::PROXMOX_BACKUP_RUN_DIR, None, Some(opts))?;
|
||||
Ok(())
|
||||
}).map_err(|err: Error| format_err!("unable to create task log dir - {}", err))
|
||||
|
@ -705,7 +705,7 @@ impl DiskState {
|
||||
return None;
|
||||
}
|
||||
match b.component_string(components.len()) {
|
||||
Ok(cs) => Some((cs.to_owned(), b.size(components.len()))),
|
||||
Ok(cs) => Some((cs, b.size(components.len()))),
|
||||
Err(_) => None,
|
||||
}
|
||||
})
|
||||
|
@ -70,8 +70,8 @@ impl RRDCache {
|
||||
.map_err(|err: Error| format_err!("unable to create rrdb stat dir - {}", err))?;
|
||||
|
||||
let config = Arc::new(CacheConfig {
|
||||
basedir: basedir.clone(),
|
||||
file_options: file_options.clone(),
|
||||
basedir: basedir,
|
||||
file_options: file_options,
|
||||
dir_options: dir_options,
|
||||
apply_interval,
|
||||
});
|
||||
|
@ -150,7 +150,7 @@ pub fn openid_login(
|
||||
};
|
||||
|
||||
let user_id = Userid::try_from(format!("{}@{}", unique_name, realm))?;
|
||||
tested_username = Some(unique_name.to_string());
|
||||
tested_username = Some(unique_name);
|
||||
|
||||
if !user_info.is_active_user_id(&user_id) {
|
||||
if config.autocreate.unwrap_or(false) {
|
||||
@ -246,8 +246,7 @@ fn openid_auth_url(
|
||||
|
||||
let open_id = openid_authenticator(&config, &redirect_url)?;
|
||||
|
||||
let url = open_id.authorize_url(PROXMOX_BACKUP_RUN_DIR_M!(), &realm)?
|
||||
.to_string();
|
||||
let url = open_id.authorize_url(PROXMOX_BACKUP_RUN_DIR_M!(), &realm)?;
|
||||
|
||||
Ok(url.into())
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ pub fn prune_datastore(
|
||||
auth_id.to_string(),
|
||||
to_stdout,
|
||||
move |worker| crate::server::prune_datastore(
|
||||
worker.clone(),
|
||||
worker,
|
||||
auth_id,
|
||||
prune_options,
|
||||
&store,
|
||||
|
@ -1179,7 +1179,6 @@ fn restore_chunk_archive<'a>(
|
||||
|
||||
let mut decoder = ChunkArchiveDecoder::new(reader);
|
||||
|
||||
let datastore2 = datastore.clone();
|
||||
let start_time = std::time::SystemTime::now();
|
||||
let bytes = Arc::new(std::sync::atomic::AtomicU64::new(0));
|
||||
let bytes2 = bytes.clone();
|
||||
@ -1190,7 +1189,7 @@ fn restore_chunk_archive<'a>(
|
||||
"tape restore chunk writer",
|
||||
4,
|
||||
move |(chunk, digest): (DataBlob, [u8; 32])| {
|
||||
let chunk_exists = datastore2.cond_touch_chunk(&digest, false)?;
|
||||
let chunk_exists = datastore.cond_touch_chunk(&digest, false)?;
|
||||
if !chunk_exists {
|
||||
if verbose {
|
||||
task_log!(worker2, "Insert chunk: {}", hex::encode(&digest));
|
||||
@ -1202,7 +1201,7 @@ fn restore_chunk_archive<'a>(
|
||||
chunk.decode(None, Some(&digest))?; // verify digest
|
||||
}
|
||||
|
||||
datastore2.insert_chunk(&chunk, &digest)?;
|
||||
datastore.insert_chunk(&chunk, &digest)?;
|
||||
} else if verbose {
|
||||
task_log!(worker2, "Found existing chunk: {}", hex::encode(&digest));
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ async fn run() -> Result<(), Error> {
|
||||
if !avoid_init {
|
||||
let backup_user = pbs_config::backup_user()?;
|
||||
let file_opts = CreateOptions::new().owner(backup_user.uid).group(backup_user.gid);
|
||||
proxmox_rest_server::init_worker_tasks(pbs_buildcfg::PROXMOX_BACKUP_LOG_DIR_M!().into(), file_opts.clone())?;
|
||||
proxmox_rest_server::init_worker_tasks(pbs_buildcfg::PROXMOX_BACKUP_LOG_DIR_M!().into(), file_opts)?;
|
||||
|
||||
let mut commando_sock = proxmox_rest_server::CommandSocket::new(proxmox_rest_server::our_ctrl_sock(), backup_user.gid);
|
||||
proxmox_rest_server::register_task_control_commands(&mut commando_sock)?;
|
||||
@ -456,7 +456,7 @@ fn get_remote(param: &HashMap<String, String>) -> Option<String> {
|
||||
.or_else(|| {
|
||||
if let Some(id) = param.get("id") {
|
||||
if let Ok(job) = get_sync_job(id) {
|
||||
return Some(job.remote.clone());
|
||||
return Some(job.remote);
|
||||
}
|
||||
}
|
||||
None
|
||||
@ -483,7 +483,7 @@ fn get_remote_store(param: &HashMap<String, String>) -> Option<(String, String)>
|
||||
let store = param
|
||||
.get("remote-store")
|
||||
.map(|r| r.to_owned())
|
||||
.or_else(|| job.map(|job| job.remote_store.clone()));
|
||||
.or_else(|| job.map(|job| job.remote_store));
|
||||
|
||||
if let Some(store) = store {
|
||||
return Some((remote, store))
|
||||
|
@ -109,8 +109,8 @@ fn test_media_set_simple() -> Result<(), Error> {
|
||||
|
||||
|
||||
let tape1_uuid = inventory.generate_used_tape("tape1", sl1.clone(), 0);
|
||||
let tape2_uuid = inventory.generate_used_tape("tape2", sl2.clone(), 0);
|
||||
let tape3_uuid = inventory.generate_used_tape("tape3", sl3.clone(), 0);
|
||||
let tape2_uuid = inventory.generate_used_tape("tape2", sl2, 0);
|
||||
let tape3_uuid = inventory.generate_used_tape("tape3", sl3, 0);
|
||||
|
||||
// generate incomplete media set in pool p2
|
||||
let sl4 = MediaSetLabel::with_data("p2", Uuid::generate(), 1, ctime + 40, None);
|
||||
@ -134,9 +134,9 @@ fn test_media_set_simple() -> Result<(), Error> {
|
||||
let media_list = media_set.media_list();
|
||||
assert_eq!(media_list.len(), 3);
|
||||
|
||||
assert_eq!(media_list[0], Some(tape1_uuid.clone()));
|
||||
assert_eq!(media_list[1], Some(tape2_uuid.clone()));
|
||||
assert_eq!(media_list[2], Some(tape3_uuid.clone()));
|
||||
assert_eq!(media_list[0], Some(tape1_uuid));
|
||||
assert_eq!(media_list[1], Some(tape2_uuid));
|
||||
assert_eq!(media_list[2], Some(tape3_uuid));
|
||||
|
||||
// test media set start time
|
||||
assert_eq!(inventory.media_set_start_time(&sl1.uuid), Some(ctime + 10));
|
||||
@ -150,7 +150,7 @@ fn test_media_set_simple() -> Result<(), Error> {
|
||||
assert_eq!(media_list.len(), 2);
|
||||
|
||||
assert_eq!(media_list[0], None);
|
||||
assert_eq!(media_list[1], Some(tape4_uuid.clone()));
|
||||
assert_eq!(media_list[1], Some(tape4_uuid));
|
||||
|
||||
// start time for incomplete set must be None
|
||||
assert_eq!(inventory.media_set_start_time(&sl4.uuid), None);
|
||||
|
@ -38,7 +38,7 @@ fn worker_task_abort() -> Result<(), Error> {
|
||||
let gid = nix::unistd::Gid::current();
|
||||
|
||||
let file_opts = CreateOptions::new().owner(uid).group(gid);
|
||||
proxmox_rest_server::init_worker_tasks("./target/tasklogtestdir".into(), file_opts.clone())?;
|
||||
proxmox_rest_server::init_worker_tasks("./target/tasklogtestdir".into(), file_opts)?;
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user