Commit badf390b authored by Ben Boeckel's avatar Ben Boeckel
Browse files

hooks: simplify hook kind extraction

parent 429ad8d7
......@@ -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"));
},
......
......@@ -531,13 +531,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