Commit 502a0268 authored by Brad King's avatar Brad King 💬 Committed by Kitware Robot
Browse files

Merge topic 'simplify-hook-deserialize'

badf390b

 hooks: simplify hook kind extraction
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King's avatarBrad King <brad.king@kitware.com>
Merge-request: !30
parents a939de59 badf390b
......@@ -261,14 +261,10 @@ impl Deserialize for SystemHook {
let val = try!(Value::deserialize(deserializer));
let event_name = match val.pointer("/event_name") {
Some(mstring) => {
match mstring.as_string() {
Some(string) => string,
None => {
return Err(D::Error::invalid_type(Type::String));
},
}
},
Some(&Value::String(ref name)) => name,
Some(_) => {
return Err(D::Error::invalid_type(Type::String));
}
None => {
return Err(D::Error::missing_field("event_name"));
},
......
......@@ -539,13 +539,9 @@ impl Deserialize for WebHook {
let val = try!(Value::deserialize(deserializer));
let object_kind = match val.pointer("/object_kind") {
Some(mstring) => {
match mstring.as_string() {
Some(string) => string,
None => {
return Err(D::Error::invalid_type(Type::String));
},
}
Some(&Value::String(ref kind)) => kind,
Some(_) => {
return Err(D::Error::invalid_type(Type::String));
},
None => {
return Err(D::Error::missing_field("object_kind"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment