chore(nightly): remove ()'s and fix benchmarks for nightly
Also ensure that `cargo bench` runs successfully on travis; the old `cargo bench ... || :` has the effect of ignoring any errors in it.
This commit is contained in:
@@ -20,7 +20,7 @@ cache:
|
||||
script:
|
||||
- cargo build --verbose $FEATURES
|
||||
- cargo test --verbose $FEATURES
|
||||
- '[ $TRAVIS_RUST_VERSION = nightly ] && cargo bench --no-run || :'
|
||||
- 'if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo bench --no-run; fi'
|
||||
|
||||
addons:
|
||||
apt:
|
||||
|
||||
12
benches/client.rs
Normal file → Executable file
12
benches/client.rs
Normal file → Executable file
@@ -7,6 +7,8 @@ extern crate test;
|
||||
use std::fmt;
|
||||
use std::io::{self, Read, Write, Cursor};
|
||||
use std::net::SocketAddr;
|
||||
#[cfg(feature = "timeouts")]
|
||||
use std::time::Duration;
|
||||
|
||||
use hyper::net;
|
||||
|
||||
@@ -73,6 +75,16 @@ impl net::NetworkStream for MockStream {
|
||||
fn peer_addr(&mut self) -> io::Result<SocketAddr> {
|
||||
Ok("127.0.0.1:1337".parse().unwrap())
|
||||
}
|
||||
#[cfg(feature = "timeouts")]
|
||||
fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
|
||||
// can't time out
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(feature = "timeouts")]
|
||||
fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
|
||||
// can't time out
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
struct MockConnector;
|
||||
|
||||
@@ -27,7 +27,7 @@ impl<A: NetworkListener + Send + 'static> ListenerPool<A> {
|
||||
let work = Arc::new(work);
|
||||
|
||||
// Begin work.
|
||||
for _ in (0..threads) {
|
||||
for _ in 0..threads {
|
||||
spawn_with(super_tx.clone(), work.clone(), self.acceptor.clone())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user