Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the tokio-core dependency where not necessary #58

Merged
merged 3 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libp2p-peerstore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ datastore = { path = "../datastore" }
futures = "0.1.0"
owning_ref = "0.3.3"
multiaddr = "0.2"
multihash = "0.7.0"
serde = "1.0"
serde_derive = "1.0"

[dev-dependencies]
multihash = "0.7.0"
tempfile = "2.2"
1 change: 0 additions & 1 deletion libp2p-peerstore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ extern crate base58;
extern crate datastore;
extern crate futures;
extern crate multiaddr;
extern crate multihash;
extern crate owning_ref;
extern crate serde;
#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion libp2p-peerstore/src/peerstore_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

macro_rules! peerstore_tests {
({$create_peerstore:expr} $({$stmt:stmt})*) => {
extern crate multihash;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably you want to put the mod whatever in this macro too (instead of requiring the user to write it) so you don't get obnoxious and difficult-to-handle errors if you call this twice in the same module

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed IRL and agreed that we wouldn't do that because it adds an indentation level and because the JSON backend requires an additional crate.

use std::thread;
use std::time::Duration;
use {Peerstore, PeerAccess};
use multiaddr::Multiaddr;
use multihash;

#[test]
fn initially_empty() {
Expand Down
4 changes: 3 additions & 1 deletion libp2p-secio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ rand = "0.3.17"
ring = { version = "0.12.1", features = ["rsa_signing"] }
rust-crypto = "^0.2"
rw-stream-sink = { path = "../rw-stream-sink" }
tokio-core = "0.1.6"
tokio-io = "0.1.0"
untrusted = "0.6.0"

[dev-dependencies]
tokio-core = "0.1.6"
7 changes: 4 additions & 3 deletions libp2p-secio/src/codec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub fn full_codec<S>(

#[cfg(test)]
mod tests {
extern crate tokio_core;
use super::DecoderMiddleware;
use super::EncoderMiddleware;
use super::full_codec;
Expand All @@ -71,9 +72,9 @@ mod tests {
use ring::hmac::SigningKey;
use ring::hmac::VerificationKey;
use std::io::Error as IoError;
use tokio_core::net::TcpListener;
use tokio_core::net::TcpStream;
use tokio_core::reactor::Core;
use self::tokio_core::net::TcpListener;
use self::tokio_core::net::TcpStream;
use self::tokio_core::reactor::Core;
use tokio_io::codec::length_delimited::Framed;

#[test]
Expand Down
7 changes: 4 additions & 3 deletions libp2p-secio/src/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ fn stretch_key(key: &SigningKey, result: &mut [u8]) {

#[cfg(test)]
mod tests {
extern crate tokio_core;
use super::handshake;
use super::stretch_key;
use futures::Future;
Expand All @@ -451,9 +452,9 @@ mod tests {
use ring::hmac::SigningKey;
use ring::signature::RSAKeyPair;
use std::sync::Arc;
use tokio_core::net::TcpListener;
use tokio_core::net::TcpStream;
use tokio_core::reactor::Core;
use self::tokio_core::net::TcpListener;
use self::tokio_core::net::TcpStream;
use self::tokio_core::reactor::Core;
use untrusted::Input;

#[test]
Expand Down
1 change: 0 additions & 1 deletion libp2p-secio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extern crate protobuf;
extern crate rand;
extern crate ring;
extern crate rw_stream_sink;
extern crate tokio_core;
extern crate tokio_io;
extern crate untrusted;

Expand Down
1 change: 0 additions & 1 deletion libp2p-swarm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ multiaddr = "0.2.0"
multistream-select = { path = "../multistream-select" }
futures = "0.1"
smallvec = "0.5"
tokio-core = "0.1"
tokio-io = "0.1"

[dev-dependencies]
Expand Down
4 changes: 3 additions & 1 deletion multistream-select/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ authors = ["Parity Technologies <[email protected]>"]
bytes = "0.4"
futures = { version = "0.1" }
smallvec = "0.5"
tokio-core = "0.1"
tokio-io = "0.1"

[dev-dependencies]
tokio-core = "0.1"
1 change: 0 additions & 1 deletion multistream-select/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
extern crate bytes;
extern crate futures;
extern crate smallvec;
extern crate tokio_core;
extern crate tokio_io;

mod dialer_select;
Expand Down
5 changes: 3 additions & 2 deletions multistream-select/src/protocol/dialer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,13 @@ impl<R> Stream for Dialer<R>

#[cfg(test)]
mod tests {
extern crate tokio_core;
use bytes::Bytes;
use futures::{Sink, Stream};
use futures::Future;
use protocol::{Dialer, DialerToListenerMessage, MultistreamSelectError};
use tokio_core::net::{TcpListener, TcpStream};
use tokio_core::reactor::Core;
use self::tokio_core::net::{TcpListener, TcpStream};
use self::tokio_core::reactor::Core;

#[test]
fn wrong_proto_name() {
Expand Down
5 changes: 3 additions & 2 deletions multistream-select/src/protocol/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,13 @@ impl<R> Stream for Listener<R>

#[cfg(test)]
mod tests {
extern crate tokio_core;
use bytes::Bytes;
use futures::{Sink, Stream};
use futures::Future;
use protocol::{Dialer, Listener, ListenerToDialerMessage, MultistreamSelectError};
use tokio_core::net::{TcpListener, TcpStream};
use tokio_core::reactor::Core;
use self::tokio_core::net::{TcpListener, TcpStream};
use self::tokio_core::reactor::Core;

#[test]
fn wrong_proto_name() {
Expand Down
8 changes: 5 additions & 3 deletions multistream-select/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@

#![cfg(test)]

extern crate tokio_core;

use {listener_select_proto, dialer_select_proto};
use ProtocolChoiceError;
use bytes::Bytes;
use dialer_select::{dialer_select_proto_parallel, dialer_select_proto_serial};
use futures::{Sink, Stream};
use futures::Future;
use protocol::{Dialer, Listener, DialerToListenerMessage, ListenerToDialerMessage};
use tokio_core::net::TcpListener;
use tokio_core::net::TcpStream;
use tokio_core::reactor::Core;
use self::tokio_core::net::TcpListener;
use self::tokio_core::net::TcpStream;
use self::tokio_core::reactor::Core;

#[test]
fn negotiate_with_self_succeeds() {
Expand Down