Skip to content

Commit

Permalink
chore(nightly): remove ()'s and fix benchmarks for nightly
Browse files Browse the repository at this point in the history
Also ensure that `cargo bench` runs successfully on travis; the old
`cargo bench ... || :` has the effect of ignoring any errors in it.
  • Loading branch information
huonw committed Oct 14, 2015
1 parent cdaa254 commit d2e9c94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions benches/client.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/server/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down

0 comments on commit d2e9c94

Please sign in to comment.