diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2022-08-09 16:42:20 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2022-08-09 16:55:22 +0200 |
commit | 0a6b80a32d523efeb02fd1924612a49eef966f08 (patch) | |
tree | eef16bad03bed0f9c07bb0aa7b932d2c451728a6 /src/task.rs | |
parent | ddac25d5b40f865d1b27ccacf0311ed22f7c32eb (diff) |
Simplify matches
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/task.rs')
-rw-r--r-- | src/task.rs | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/task.rs b/src/task.rs index 8874e91..b0e4699 100644 --- a/src/task.rs +++ b/src/task.rs @@ -781,25 +781,10 @@ impl<'de> Visitor<'de> for TaskDeserializeVisitor { } } - let status = match status { - Some(status) => status, - None => Err(V::Error::missing_field("status"))?, - }; - - let uuid = match uuid { - Some(uuid) => uuid, - None => Err(V::Error::missing_field("uuid"))?, - }; - - let entry = match entry { - Some(entry) => entry, - None => Err(V::Error::missing_field("entry"))?, - }; - - let description = match description { - Some(description) => description, - None => Err(V::Error::missing_field("description"))?, - }; + let status = status.ok_or_else(|| V::Error::missing_field("status"))?; + let uuid = uuid.ok_or_else(|| V::Error::missing_field("uuid"))?; + let entry = entry.ok_or_else(|| V::Error::missing_field("entry"))?; + let description = description.ok_or_else(|| V::Error::missing_field("description"))?; let task = Task::new( id, |