test(lib): deny warnings
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
#![doc(html_root_url = "https://docs.rs/hyper/0.13.0-alpha.1")]
|
#![doc(html_root_url = "https://docs.rs/hyper/0.13.0-alpha.1")]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![deny(missing_debug_implementations)]
|
#![deny(missing_debug_implementations)]
|
||||||
#![deny(rust_2018_idioms)]
|
#![cfg_attr(test, deny(rust_2018_idioms))]
|
||||||
// TODO: re-enable denial when all lib tests are re-enabled.
|
#![cfg_attr(test, deny(warnings))]
|
||||||
//#![cfg_attr(test, deny(warnings))]
|
|
||||||
#![cfg_attr(all(test, feature = "nightly"), feature(test))]
|
#![cfg_attr(all(test, feature = "nightly"), feature(test))]
|
||||||
|
|
||||||
//! # hyper
|
//! # hyper
|
||||||
|
|||||||
@@ -876,9 +876,7 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
//TODO: rewrite these using dispatch
|
|
||||||
mod tests {
|
mod tests {
|
||||||
/*
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_read_head_short(b: &mut ::test::Bencher) {
|
fn bench_read_head_short(b: &mut ::test::Bencher) {
|
||||||
@@ -887,33 +885,39 @@ mod tests {
|
|||||||
let len = s.len();
|
let len = s.len();
|
||||||
b.bytes = len as u64;
|
b.bytes = len as u64;
|
||||||
|
|
||||||
let mut io = crate::mock::AsyncIo::new_buf(Vec::new(), 0);
|
// an empty IO, we'll be skipping and using the read buffer anyways
|
||||||
io.panic();
|
let io = tokio_test::io::Builder::new().build();
|
||||||
let mut conn = Conn::<_, crate::Chunk, crate::proto::h1::ServerTransaction>::new(io);
|
let mut conn = Conn::<_, crate::Chunk, crate::proto::h1::ServerTransaction>::new(io);
|
||||||
*conn.io.read_buf_mut() = ::bytes::BytesMut::from(&s[..]);
|
*conn.io.read_buf_mut() = ::bytes::BytesMut::from(&s[..]);
|
||||||
conn.state.cached_headers = Some(HeaderMap::with_capacity(2));
|
conn.state.cached_headers = Some(HeaderMap::with_capacity(2));
|
||||||
|
|
||||||
|
let mut rt = tokio::runtime::current_thread::Runtime::new().unwrap();
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
match conn.read_head().unwrap() {
|
rt.block_on(futures_util::future::poll_fn(|cx| {
|
||||||
Async::Ready(Some(x)) => {
|
match conn.poll_read_head(cx) {
|
||||||
::test::black_box(&x);
|
Poll::Ready(Some(Ok(x))) => {
|
||||||
let mut headers = x.0.headers;
|
::test::black_box(&x);
|
||||||
headers.clear();
|
let mut headers = x.0.headers;
|
||||||
conn.state.cached_headers = Some(headers);
|
headers.clear();
|
||||||
},
|
conn.state.cached_headers = Some(headers);
|
||||||
f => panic!("expected Ready(Some(..)): {:?}", f)
|
},
|
||||||
}
|
f => panic!("expected Ready(Some(Ok(..))): {:?}", f)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
conn.io.read_buf_mut().reserve(1);
|
conn.io.read_buf_mut().reserve(1);
|
||||||
unsafe {
|
unsafe {
|
||||||
conn.io.read_buf_mut().set_len(len);
|
conn.io.read_buf_mut().set_len(len);
|
||||||
}
|
}
|
||||||
conn.state.reading = Reading::Init;
|
conn.state.reading = Reading::Init;
|
||||||
|
Poll::Ready(())
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
|
//TODO: rewrite these using dispatch... someday...
|
||||||
use futures::{Async, Future, Stream, Sink};
|
use futures::{Async, Future, Stream, Sink};
|
||||||
use futures::future;
|
use futures::future;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user