clippy: convert single match to if let

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-01-19 12:09:33 +01:00
parent ea368a06cd
commit b92cad0938
7 changed files with 66 additions and 88 deletions

View File

@ -39,13 +39,12 @@ pub fn do_garbage_collection_job(
let status = worker.create_state(&result);
match job.finish(status) {
Err(err) => eprintln!(
if let Err(err) = job.finish(status) {
eprintln!(
"could not finish job state for {}: {}",
job.jobtype().to_string(),
err
),
Ok(_) => (),
);
}
if let Some(email) = email {

View File

@ -207,11 +207,8 @@ impl Job {
/// Start the job and update the statefile accordingly
/// Fails if the job was already started
pub fn start(&mut self, upid: &str) -> Result<(), Error> {
match self.state {
JobState::Started { .. } => {
bail!("cannot start job that is started!");
}
_ => {}
if let JobState::Started { .. } = self.state {
bail!("cannot start job that is started!");
}
self.state = JobState::Started {

View File

@ -83,13 +83,12 @@ pub fn do_verification_job(
let status = worker.create_state(&job_result);
match job.finish(status) {
Err(err) => eprintln!(
if let Err(err) = job.finish(status) {
eprintln!(
"could not finish job state for {}: {}",
job.jobtype().to_string(),
err
),
Ok(_) => (),
);
}
if let Some(email) = email {