mirror of
https://github.com/OMGeeky/tarpc.git
synced 2025-12-28 07:12:05 +01:00
Clean up code warnings
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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(()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user