Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nicholas Bailey
rust-gitlab
Commits
badf390b
Commit
badf390b
authored
Sep 22, 2016
by
Ben Boeckel
Browse files
hooks: simplify hook kind extraction
parent
429ad8d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/systemhooks.rs.in
View file @
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"));
},
...
...
src/webhooks.rs.in
View file @
badf390b
...
...
@@ -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"));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment