]> git.proxmox.com Git - proxmox-backup.git/blobdiff - src/api2/config/sync.rs
clippy: is_some/none/ok/err/empty
[proxmox-backup.git] / src / api2 / config / sync.rs
index bdad21e6b641b3d8cc136bbb97074842fd798632..e7360051db018bf889e01a6136075a617841896d 100644 (file)
@@ -154,14 +154,14 @@ pub fn create_sync_job(
 
     let _lock = open_file_locked(sync::SYNC_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?;
 
-    let sync_job: sync::SyncJobConfig = serde_json::from_value(param.clone())?;
+    let sync_job: sync::SyncJobConfig = serde_json::from_value(param)?;
     if !check_sync_job_modify_access(&user_info, &auth_id, &sync_job) {
         bail!("permission check failed");
     }
 
     let (mut config, _digest) = sync::config()?;
 
-    if let Some(_) = config.sections.get(&sync_job.id) {
+    if config.sections.get(&sync_job.id).is_some() {
         bail!("job '{}' already exists.", sync_job.id);
     }
 
@@ -182,10 +182,7 @@ pub fn create_sync_job(
             },
         },
     },
-    returns: {
-        description: "The sync job configuration.",
-        type: sync::SyncJobConfig,
-    },
+    returns: { type: sync::SyncJobConfig },
     access: {
         description: "Limited to sync job entries where user has Datastore.Audit on target datastore, and Remote.Audit on source remote.",
         permission: &Permission::Anybody,
@@ -517,7 +514,7 @@ acl:1:/remote/remote1/remotestore1:write@pbs:RemoteSyncOperator
 
     // unless they have Datastore.Modify as well
     job.store = "localstore3".to_string();
-    job.owner = Some(read_auth_id.clone());
+    job.owner = Some(read_auth_id);
     assert_eq!(check_sync_job_modify_access(&user_info, &write_auth_id, &job), true);
     job.owner = None;
     assert_eq!(check_sync_job_modify_access(&user_info, &write_auth_id, &job), true);