From 98ff2f8a24f0d32043b4de9b5671a4d882a6e903 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 12 Nov 2017 20:12:25 +0100 Subject: request_job(): Use `Job::new()` Realised that the reason why I was getting a dead code warning from `Job::new` was not just because I wasn't using it, but because I was meant to use it somewhere. Remove the duplicate work going on in `request_job()` and replace it with a call to `Job::new()` instead. --- src/jenkins.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/jenkins.rs b/src/jenkins.rs index a41b11c..f2da0d2 100644 --- a/src/jenkins.rs +++ b/src/jenkins.rs @@ -238,14 +238,9 @@ pub fn request_job( let body = response.text()?; - let mut job = json::parse(body.as_ref())?; + let job = Job::new(body)?; - Ok( - Job { - display_name: job["displayName"].take_string().unwrap_or_default(), - result: result_from_job(job["result"].take_string()), - } - ) + Ok(job) } // Does the `commit_ref` correspond to the job? -- cgit v1.2.3