Clean up code warnings

This commit is contained in:
Tim Kuehn
2018-03-25 23:52:36 -07:00
parent 326f0270b9
commit b2282f9d7a
5 changed files with 9 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
// Licensed under the MIT License, <LICENSE or http://opensource.org/licenses/MIT>.
// This file may not be copied, modified, or distributed except according to those terms.
#![feature(inclusive_range_syntax, conservative_impl_trait, plugin, never_type, use_extern_macros)]
#![feature(conservative_impl_trait, plugin, never_type, use_extern_macros)]
#![plugin(tarpc_plugins)]
extern crate chrono;

View File

@@ -117,7 +117,7 @@ impl publisher::FutureService for Publisher {
fn unsubscribe(&self, id: u32) -> Self::UnsubscribeFut {
println!("Unsubscribing {}", id);
self.clients.borrow_mut().remove(&id).unwrap();
futures::finished(()).boxed()
Box::new(futures::finished(()))
}
}

View File

@@ -14,7 +14,7 @@ extern crate tokio_core;
use add::{FutureService as AddFutureService, FutureServiceExt as AddExt};
use double::{FutureService as DoubleFutureService, FutureServiceExt as DoubleExt};
use futures::{BoxFuture, Future, Stream};
use futures::{Future, Stream};
use tarpc::future::{client, server};
use tarpc::future::client::ClientExt as Fc;
use tarpc::util::{FirstSocketAddr, Message, Never};
@@ -59,13 +59,12 @@ impl DoubleServer {
}
impl DoubleFutureService for DoubleServer {
type DoubleFut = BoxFuture<i32, Message>;
type DoubleFut = Box<Future<Item=i32, Error=Message>>;
fn double(&self, x: i32) -> Self::DoubleFut {
self.client
Box::new(self.client
.add(x, x)
.map_err(|e| e.to_string().into())
.boxed()
.map_err(|e| e.to_string().into()))
}
}

View File

@@ -20,12 +20,12 @@ impl Tracker {
}
pub fn increment(&self) {
let _ = self.tx.send(Action::Increment);
let _ = self.tx.unbounded_send(Action::Increment);
}
pub fn decrement(&self) {
debug!("Closing connection");
let _ = self.tx.send(Action::Decrement);
let _ = self.tx.unbounded_send(Action::Decrement);
}
}

View File

@@ -36,7 +36,7 @@ impl Shutdown {
/// The returned future resolves when the server is completely shut down.
pub fn shutdown(&self) -> ShutdownFuture {
let (tx, rx) = oneshot::channel();
let inner = if self.tx.send(tx).is_err() {
let inner = if self.tx.unbounded_send(tx).is_err() {
trace!("Server already initiated shutdown.");
futures::Either::A(futures::ok(()))
} else {