From ce7c0893bccd1703a369e9fc5362cc7175b68288 Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Mon, 6 Nov 2017 16:28:31 +0100 Subject: [PATCH] Cleanup --- src/resources/diff_resource.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/resources/diff_resource.rs b/src/resources/diff_resource.rs index bdc7db9..2a0bdb6 100644 --- a/src/resources/diff_resource.rs +++ b/src/resources/diff_resource.rs @@ -2,7 +2,7 @@ use std::fmt; use diff; use futures::{self, Future}; -use futures::future::{finished, done}; +use futures::future::done; use hyper; use hyper::header::ContentType; use hyper::server::*; @@ -57,11 +57,11 @@ impl DiffLookup { let from = state.get_article_revision(article_id as i32, params.from as i32); let to = state.get_article_revision(article_id as i32, params.to as i32); - finished(state).join3(from, to) - }).and_then(move |(state, from, to)| { + from.join(to) + }).and_then(move |(from, to)| { match (from, to) { (Some(from), Some(to)) => - Ok(Some(Box::new(DiffResource::new(state, from, to)) as BoxResource)), + Ok(Some(Box::new(DiffResource::new(from, to)) as BoxResource)), _ => Ok(None), } @@ -70,15 +70,14 @@ impl DiffLookup { } pub struct DiffResource { - state: State, from: ArticleRevision, to: ArticleRevision, } impl DiffResource { - pub fn new(state: State, from: ArticleRevision, to: ArticleRevision) -> Self { + pub fn new(from: ArticleRevision, to: ArticleRevision) -> Self { assert_eq!(from.article_id, to.article_id); - Self { state, from, to } + Self { from, to } } }