aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2017-11-17 00:20:47 +0100
committerTeddy Wing2017-11-17 00:20:47 +0100
commit7a4b816b6dc8c826db49bc5997709b8e7d1f6933 (patch)
treed32436f93f2ace30c3f56b63f9b00f4a0945041e /src/main.rs
parent23569d5af9d78d91ac8b8536552985175ddff302 (diff)
downloadkipper-7a4b816b6dc8c826db49bc5997709b8e7d1f6933.tar.bz2
main(): Move `body` var definition to where it's used
Don't bother creating the variable if we don't receive any data. Instead, initialise the variable right where we need it.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index c7be3ee..9ac9570 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -122,12 +122,11 @@ fn main() {
rouille::start_server(format!("127.0.0.1:{}", port), move |request| {
router!(request,
(POST) (/github/pull_request_event) => {
- let mut body = String::new();
-
match request.data() {
None => rouille::Response::text("400 Bad Request")
.with_status_code(400),
Some(mut data) => {
+ let mut body = String::new();
try_or_400!(data.read_to_string(&mut body));
let commit_ref = match CommitRef::new(body.as_ref()) {