style(lib): use rust 2018 edition idioms (#1910)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#![deny(warnings)]
|
||||
extern crate hyper;
|
||||
extern crate pretty_env_logger;
|
||||
|
||||
#![warn(rust_2018_idioms)]
|
||||
use std::env;
|
||||
use std::io::{self, Write};
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#![deny(warnings)]
|
||||
extern crate hyper;
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
|
||||
use hyper::Client;
|
||||
use futures_util::TryStreamExt;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#![deny(warnings)]
|
||||
extern crate hyper;
|
||||
extern crate pretty_env_logger;
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use hyper::{Body, Request, Response, Server};
|
||||
use hyper::service::{service_fn, make_service_fn};
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// #![deny(warnings)] // FIXME: https://github.com/rust-lang/rust/issues/62411
|
||||
extern crate hyper;
|
||||
extern crate pretty_env_logger;
|
||||
extern crate url;
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use hyper::{Body, Method, Request, Response, Server, StatusCode};
|
||||
use hyper::service::{service_fn, make_service_fn};
|
||||
|
||||
@@ -7,7 +7,6 @@ use futures_core::{Stream, TryStream};
|
||||
use futures_channel::{mpsc, oneshot};
|
||||
use futures_util::TryStreamExt;
|
||||
//use tokio_buf::SizeHint;
|
||||
use h2;
|
||||
use http::HeaderMap;
|
||||
|
||||
use crate::common::{Future, Never, Pin, Poll, task};
|
||||
@@ -130,7 +129,6 @@ impl Body {
|
||||
///
|
||||
/// ```
|
||||
/// # use hyper::Body;
|
||||
/// # use futures_util;
|
||||
/// # fn main() {
|
||||
/// let chunks: Vec<Result<_, ::std::io::Error>> = vec![
|
||||
/// Ok("hello"),
|
||||
@@ -346,7 +344,7 @@ impl Payload for Body {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Body {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
#[derive(Debug)]
|
||||
struct Streaming;
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -113,7 +113,7 @@ impl AsRef<[u8]> for Chunk {
|
||||
|
||||
impl fmt::Debug for Chunk {
|
||||
#[inline]
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt(&self.bytes, f)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ use std::sync::Arc;
|
||||
|
||||
use bytes::Bytes;
|
||||
use futures_util::future::{self, Either, FutureExt as _};
|
||||
use h2;
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use crate::body::Payload;
|
||||
@@ -258,7 +257,7 @@ impl<T, B> Service for SendRequest<T, B> {
|
||||
*/
|
||||
|
||||
impl<B> fmt::Debug for SendRequest<B> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("SendRequest")
|
||||
.finish()
|
||||
}
|
||||
@@ -305,7 +304,7 @@ where
|
||||
}
|
||||
|
||||
impl<B> fmt::Debug for Http2SendRequest<B> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Http2SendRequest")
|
||||
.finish()
|
||||
}
|
||||
@@ -410,7 +409,7 @@ where
|
||||
T: AsyncRead + AsyncWrite + fmt::Debug + Send + 'static,
|
||||
B: Payload + 'static,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Connection")
|
||||
.finish()
|
||||
}
|
||||
@@ -575,7 +574,7 @@ impl Future for ResponseFuture {
|
||||
}
|
||||
|
||||
impl fmt::Debug for ResponseFuture {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("ResponseFuture")
|
||||
.finish()
|
||||
}
|
||||
|
||||
@@ -75,13 +75,13 @@ impl Name {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt(&self.host, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(&self.host, f)
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ impl FromStr for Name {
|
||||
pub struct InvalidNameError(());
|
||||
|
||||
impl fmt::Display for InvalidNameError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str("Not a valid domain name")
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ impl Resolve for GaiResolver {
|
||||
}
|
||||
|
||||
impl fmt::Debug for GaiResolver {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.pad("GaiResolver")
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ impl Future for GaiFuture {
|
||||
}
|
||||
|
||||
impl fmt::Debug for GaiFuture {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.pad("GaiFuture")
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ impl Iterator for GaiAddrs {
|
||||
}
|
||||
|
||||
impl fmt::Debug for GaiAddrs {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.pad("GaiAddrs")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ impl<R> HttpConnector<R> {
|
||||
|
||||
// R: Debug required for now to allow adding it to debug output later...
|
||||
impl<R: fmt::Debug> fmt::Debug for HttpConnector<R> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("HttpConnector")
|
||||
.finish()
|
||||
}
|
||||
@@ -282,7 +282,7 @@ enum InvalidUrl {
|
||||
}
|
||||
|
||||
impl fmt::Display for InvalidUrl {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(self.description())
|
||||
}
|
||||
}
|
||||
@@ -382,7 +382,7 @@ where
|
||||
}
|
||||
|
||||
impl<R: Resolve + fmt::Debug> fmt::Debug for HttpConnecting<R> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.pad("HttpConnecting")
|
||||
}
|
||||
}
|
||||
@@ -615,8 +615,6 @@ mod tests {
|
||||
#[test]
|
||||
#[cfg_attr(not(feature = "__internal_happy_eyeballs_tests"), ignore)]
|
||||
fn client_happy_eyeballs() {
|
||||
extern crate pretty_env_logger;
|
||||
|
||||
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, TcpListener};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ impl Clone for Extra {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Extra {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Extra")
|
||||
.finish()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use futures_core::Stream;
|
||||
use futures_channel::{mpsc, oneshot};
|
||||
use futures_util::future;
|
||||
use want;
|
||||
|
||||
use crate::common::{Future, Never, Pin, Poll, task};
|
||||
|
||||
@@ -254,7 +253,6 @@ mod tests {
|
||||
// trigger a warning to remind us
|
||||
use crate::Error;
|
||||
/*
|
||||
extern crate pretty_env_logger;
|
||||
#[cfg(feature = "nightly")]
|
||||
extern crate test;
|
||||
|
||||
|
||||
@@ -137,7 +137,6 @@ impl Client<(), Body> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate hyper;
|
||||
/// # #[cfg(feature = "runtime")]
|
||||
/// # fn run () {
|
||||
/// use hyper::Client;
|
||||
@@ -175,7 +174,6 @@ where C: Connect + Sync + 'static,
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate hyper;
|
||||
/// # #[cfg(feature = "runtime")]
|
||||
/// # fn run () {
|
||||
/// use hyper::{Client, Uri};
|
||||
@@ -205,7 +203,6 @@ where C: Connect + Sync + 'static,
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate hyper;
|
||||
/// # #[cfg(feature = "runtime")]
|
||||
/// # fn run () {
|
||||
/// use hyper::{Body, Client, Request};
|
||||
@@ -558,7 +555,7 @@ impl<C, B> Clone for Client<C, B> {
|
||||
}
|
||||
|
||||
impl<C, B> fmt::Debug for Client<C, B> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Client")
|
||||
.finish()
|
||||
}
|
||||
@@ -580,7 +577,7 @@ impl ResponseFuture {
|
||||
}
|
||||
|
||||
impl fmt::Debug for ResponseFuture {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.pad("Future<Response>")
|
||||
}
|
||||
}
|
||||
@@ -821,7 +818,6 @@ fn set_scheme(uri: &mut Uri, scheme: Scheme) {
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate hyper;
|
||||
/// # #[cfg(feature = "runtime")]
|
||||
/// # fn run () {
|
||||
/// use hyper::Client;
|
||||
@@ -1053,7 +1049,7 @@ impl Builder {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Builder {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Builder")
|
||||
.field("client_config", &self.client_config)
|
||||
.field("conn_builder", &self.conn_builder)
|
||||
@@ -1097,7 +1093,6 @@ mod unit_tests {
|
||||
|
||||
#[test]
|
||||
fn test_authority_form() {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
|
||||
let mut uri = "http://hyper.rs".parse().unwrap();
|
||||
|
||||
@@ -171,7 +171,7 @@ impl<T: Poolable> Pool<T> {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn locked(&self) -> ::std::sync::MutexGuard<PoolInner<T>> {
|
||||
fn locked(&self) -> ::std::sync::MutexGuard<'_, PoolInner<T>> {
|
||||
self
|
||||
.inner
|
||||
.as_ref()
|
||||
@@ -263,7 +263,7 @@ impl<T: Poolable> Pool<T> {
|
||||
}
|
||||
|
||||
/// Pop off this list, looking for a usable connection that hasn't expired.
|
||||
struct IdlePopper<'a, T: 'a> {
|
||||
struct IdlePopper<'a, T> {
|
||||
key: &'a Key,
|
||||
list: &'a mut Vec<Idle<T>>,
|
||||
}
|
||||
@@ -547,7 +547,7 @@ impl<T: Poolable> Drop for Pooled<T> {
|
||||
}
|
||||
|
||||
impl<T: Poolable> fmt::Debug for Pooled<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Pooled")
|
||||
.field("key", &self.key)
|
||||
.finish()
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
use super::Client;
|
||||
/*
|
||||
#![cfg(feature = "runtime")]
|
||||
extern crate pretty_env_logger;
|
||||
|
||||
use futures::{Async, Future, Stream};
|
||||
use futures::future::poll_fn;
|
||||
|
||||
@@ -57,13 +57,13 @@ impl Exec {
|
||||
struct TokioSpawnError;
|
||||
|
||||
impl fmt::Debug for TokioSpawnError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt("tokio::spawn failed (is a tokio runtime running this future?)", f)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for TokioSpawnError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt("tokio::spawn failed (is a tokio runtime running this future?)", f)
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ impl Exec {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Exec {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Exec")
|
||||
.finish()
|
||||
}
|
||||
|
||||
@@ -129,8 +129,7 @@ mod tests {
|
||||
use super::Rewind;
|
||||
/*
|
||||
use super::*;
|
||||
extern crate tokio_mockstream;
|
||||
use self::tokio_mockstream::MockStream;
|
||||
use tokio_mockstream::MockStream;
|
||||
use std::io::Cursor;
|
||||
|
||||
// Test a partial rewind
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::fmt;
|
||||
pub enum Never {}
|
||||
|
||||
impl fmt::Display for Never {
|
||||
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use super::Never;
|
||||
/// A function to help "yield" a future, such that it is re-scheduled immediately.
|
||||
///
|
||||
/// Useful for spin counts, so a future doesn't hog too much time.
|
||||
pub(crate) fn yield_now(cx: &mut Context) -> Poll<Never> {
|
||||
pub(crate) fn yield_now(cx: &mut Context<'_>) -> Poll<Never> {
|
||||
cx.waker().wake_by_ref();
|
||||
Poll::Pending
|
||||
}
|
||||
|
||||
@@ -3,10 +3,6 @@ use std::error::Error as StdError;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
|
||||
use httparse;
|
||||
use http;
|
||||
use h2;
|
||||
|
||||
/// Result type often returned from methods that can have hyper `Error`s.
|
||||
pub type Result<T> = ::std::result::Result<T, Error>;
|
||||
|
||||
@@ -284,7 +280,7 @@ impl Error {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut f = f.debug_tuple("Error");
|
||||
f.field(&self.inner.kind);
|
||||
if let Some(ref cause) = self.inner.cause {
|
||||
@@ -295,7 +291,7 @@ impl fmt::Debug for Error {
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if let Some(ref cause) = self.inner.cause {
|
||||
write!(f, "{}: {}", self.description(), cause)
|
||||
} else {
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn content_length_parse_all(headers: &HeaderMap) -> Option<u64> {
|
||||
content_length_parse_all_values(headers.get_all(CONTENT_LENGTH).into_iter())
|
||||
}
|
||||
|
||||
pub fn content_length_parse_all_values(values: ValueIter<HeaderValue>) -> Option<u64> {
|
||||
pub fn content_length_parse_all_values(values: ValueIter<'_, HeaderValue>) -> Option<u64> {
|
||||
// If multiple Content-Length headers were sent, everything can still
|
||||
// be alright if they all contain the same value, and all parse
|
||||
// correctly. If not, then it's an error.
|
||||
@@ -74,7 +74,7 @@ pub fn transfer_encoding_is_chunked(headers: &HeaderMap) -> bool {
|
||||
is_chunked(headers.get_all(TRANSFER_ENCODING).into_iter())
|
||||
}
|
||||
|
||||
pub fn is_chunked(mut encodings: ValueIter<HeaderValue>) -> bool {
|
||||
pub fn is_chunked(mut encodings: ValueIter<'_, HeaderValue>) -> bool {
|
||||
// chunked must always be the last encoding, according to spec
|
||||
if let Some(line) = encodings.next_back() {
|
||||
return is_chunked_(line);
|
||||
@@ -94,7 +94,7 @@ pub fn is_chunked_(value: &HeaderValue) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn add_chunked(mut entry: OccupiedEntry<HeaderValue>) {
|
||||
pub fn add_chunked(mut entry: OccupiedEntry<'_, HeaderValue>) {
|
||||
const CHUNKED: &'static str = "chunked";
|
||||
|
||||
if let Some(line) = entry.iter_mut().next_back() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#![doc(html_root_url = "https://docs.rs/hyper/0.12.32")]
|
||||
#![deny(missing_docs)]
|
||||
#![deny(missing_debug_implementations)]
|
||||
#![deny(rust_2018_idioms)]
|
||||
// XXX NOOOOOOOO
|
||||
//#![cfg_attr(test, deny(warnings))]
|
||||
#![allow(warnings)]
|
||||
@@ -19,7 +20,7 @@
|
||||
//! If looking for just a convenient HTTP client, consider the
|
||||
//! [reqwest](https://crates.io/crates/reqwest) crate.
|
||||
|
||||
#[doc(hidden)] pub extern crate http;
|
||||
#[doc(hidden)] pub use http;
|
||||
#[macro_use] extern crate log;
|
||||
|
||||
#[cfg(all(test, feature = "nightly"))]
|
||||
|
||||
@@ -646,7 +646,7 @@ where I: AsyncRead + AsyncWrite + Unpin,
|
||||
}
|
||||
|
||||
impl<I, B: Buf, T> fmt::Debug for Conn<I, B, T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Conn")
|
||||
.field("state", &self.state)
|
||||
.field("io", &self.io)
|
||||
@@ -701,7 +701,7 @@ enum Writing {
|
||||
}
|
||||
|
||||
impl fmt::Debug for State {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut builder = f.debug_struct("State");
|
||||
builder
|
||||
.field("reading", &self.reading)
|
||||
@@ -720,7 +720,7 @@ impl fmt::Debug for State {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Writing {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
Writing::Init => f.write_str("Init"),
|
||||
Writing::Body(ref enc) => f.debug_tuple("Body")
|
||||
@@ -1112,7 +1112,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_conn_body_write_length() {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
let _: Result<(), ()> = future::lazy(|| {
|
||||
let io = AsyncIo::new_buf(vec![], 0);
|
||||
|
||||
@@ -147,7 +147,7 @@ impl Decoder {
|
||||
|
||||
|
||||
impl fmt::Debug for Decoder {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt(&self.kind, f)
|
||||
}
|
||||
}
|
||||
@@ -306,7 +306,7 @@ impl ChunkedState {
|
||||
struct IncompleteBody;
|
||||
|
||||
impl fmt::Display for IncompleteBody {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(self.description())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,8 +602,6 @@ mod tests {
|
||||
// trigger a warning to remind us
|
||||
use crate::Error;
|
||||
/*
|
||||
extern crate pretty_env_logger;
|
||||
|
||||
use super::*;
|
||||
use crate::mock::AsyncIo;
|
||||
use crate::proto::h1::ClientTransaction;
|
||||
|
||||
@@ -298,7 +298,7 @@ impl Buf for ChunkSize {
|
||||
}
|
||||
|
||||
impl fmt::Debug for ChunkSize {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("ChunkSize")
|
||||
.field("bytes", &&self.bytes[..self.len.into()])
|
||||
.field("pos", &self.pos)
|
||||
|
||||
@@ -42,7 +42,7 @@ impl<T, B> fmt::Debug for Buffered<T, B>
|
||||
where
|
||||
B: Buf,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Buffered")
|
||||
.field("read_buf", &self.read_buf)
|
||||
.field("write_buf", &self.write_buf)
|
||||
@@ -135,7 +135,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn parse<S>(&mut self, cx: &mut task::Context<'_>, parse_ctx: ParseContext)
|
||||
pub(super) fn parse<S>(&mut self, cx: &mut task::Context<'_>, parse_ctx: ParseContext<'_>)
|
||||
-> Poll<crate::Result<ParsedMessage<S::Incoming>>>
|
||||
where
|
||||
S: Http1Transaction,
|
||||
@@ -376,7 +376,7 @@ impl Cursor<Vec<u8>> {
|
||||
}
|
||||
|
||||
impl<T: AsRef<[u8]>> fmt::Debug for Cursor<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Cursor")
|
||||
.field("pos", &self.pos)
|
||||
.field("len", &self.bytes.as_ref().len())
|
||||
@@ -433,7 +433,7 @@ where
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn auto(&mut self) -> WriteBufAuto<B> {
|
||||
fn auto(&mut self) -> WriteBufAuto<'_, B> {
|
||||
WriteBufAuto::new(self)
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ where
|
||||
}
|
||||
|
||||
impl<B: Buf> fmt::Debug for WriteBuf<B> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("WriteBuf")
|
||||
.field("remaining", &self.remaining())
|
||||
.field("strategy", &self.strategy)
|
||||
@@ -528,7 +528,7 @@ impl<B: Buf> Buf for WriteBuf<B> {
|
||||
|
||||
/// Detects when wrapped `WriteBuf` is used for vectored IO, and
|
||||
/// adjusts the `WriteBuf` strategy if not.
|
||||
struct WriteBufAuto<'a, B: Buf + 'a> {
|
||||
struct WriteBufAuto<'a, B: Buf> {
|
||||
bytes_called: Cell<bool>,
|
||||
bytes_vec_called: Cell<bool>,
|
||||
inner: &'a mut WriteBuf<B>,
|
||||
@@ -822,7 +822,6 @@ mod tests {
|
||||
TODO: needs tokio_test::io to allow configure write_buf calls
|
||||
#[test]
|
||||
fn write_buf_queue() {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
|
||||
let mock = AsyncIo::new_buf(vec![], 1024);
|
||||
@@ -844,7 +843,6 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn write_buf_flatten() {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
|
||||
let mock = Mock::new()
|
||||
@@ -866,7 +864,6 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn write_buf_auto_flatten() {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
|
||||
let mock = Mock::new()
|
||||
@@ -894,7 +891,6 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn write_buf_queue_disable_auto() {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
|
||||
let mock = Mock::new()
|
||||
|
||||
@@ -26,8 +26,8 @@ pub(crate) trait Http1Transaction {
|
||||
type Incoming;
|
||||
type Outgoing: Default;
|
||||
const LOG: &'static str;
|
||||
fn parse(bytes: &mut BytesMut, ctx: ParseContext) -> ParseResult<Self::Incoming>;
|
||||
fn encode(enc: Encode<Self::Outgoing>, dst: &mut Vec<u8>) -> crate::Result<Encoder>;
|
||||
fn parse(bytes: &mut BytesMut, ctx: ParseContext<'_>) -> ParseResult<Self::Incoming>;
|
||||
fn encode(enc: Encode<'_, Self::Outgoing>, dst: &mut Vec<u8>) -> crate::Result<Encoder>;
|
||||
|
||||
fn on_error(err: &crate::Error) -> Option<MessageHead<Self::Outgoing>>;
|
||||
|
||||
@@ -68,7 +68,7 @@ pub(crate) struct ParseContext<'a> {
|
||||
}
|
||||
|
||||
/// Passed to Http1Transaction::encode
|
||||
pub(crate) struct Encode<'a, T: 'a> {
|
||||
pub(crate) struct Encode<'a, T> {
|
||||
head: &'a mut MessageHead<T>,
|
||||
body: Option<BodyLength>,
|
||||
keep_alive: bool,
|
||||
|
||||
@@ -8,7 +8,6 @@ use std::mem;
|
||||
use bytes::{BytesMut};
|
||||
use http::header::{self, Entry, HeaderName, HeaderValue};
|
||||
use http::{HeaderMap, Method, StatusCode, Version};
|
||||
use httparse;
|
||||
|
||||
use crate::error::Parse;
|
||||
use crate::headers;
|
||||
@@ -68,7 +67,7 @@ impl Http1Transaction for Server {
|
||||
type Outgoing = StatusCode;
|
||||
const LOG: &'static str = "{role=server}";
|
||||
|
||||
fn parse(buf: &mut BytesMut, ctx: ParseContext) -> ParseResult<RequestLine> {
|
||||
fn parse(buf: &mut BytesMut, ctx: ParseContext<'_>) -> ParseResult<RequestLine> {
|
||||
if buf.is_empty() {
|
||||
return Ok(None);
|
||||
}
|
||||
@@ -86,7 +85,7 @@ impl Http1Transaction for Server {
|
||||
// a good ~5% on pipeline benchmarks.
|
||||
let mut headers_indices: [HeaderIndices; MAX_HEADERS] = unsafe { mem::uninitialized() };
|
||||
{
|
||||
let mut headers: [httparse::Header; MAX_HEADERS] = unsafe { mem::uninitialized() };
|
||||
let mut headers: [httparse::Header<'_>; MAX_HEADERS] = unsafe { mem::uninitialized() };
|
||||
trace!("Request.parse([Header; {}], [u8; {}])", headers.len(), buf.len());
|
||||
let mut req = httparse::Request::new(&mut headers);
|
||||
let bytes = buf.as_ref();
|
||||
@@ -239,7 +238,7 @@ impl Http1Transaction for Server {
|
||||
}))
|
||||
}
|
||||
|
||||
fn encode(mut msg: Encode<Self::Outgoing>, mut dst: &mut Vec<u8>) -> crate::Result<Encoder> {
|
||||
fn encode(mut msg: Encode<'_, Self::Outgoing>, mut dst: &mut Vec<u8>) -> crate::Result<Encoder> {
|
||||
trace!(
|
||||
"Server::encode status={:?}, body={:?}, req_method={:?}",
|
||||
msg.head.subject,
|
||||
@@ -589,7 +588,7 @@ impl Http1Transaction for Client {
|
||||
type Outgoing = RequestLine;
|
||||
const LOG: &'static str = "{role=client}";
|
||||
|
||||
fn parse(buf: &mut BytesMut, ctx: ParseContext) -> ParseResult<StatusCode> {
|
||||
fn parse(buf: &mut BytesMut, ctx: ParseContext<'_>) -> ParseResult<StatusCode> {
|
||||
// Loop to skip information status code headers (100 Continue, etc).
|
||||
loop {
|
||||
if buf.is_empty() {
|
||||
@@ -598,7 +597,7 @@ impl Http1Transaction for Client {
|
||||
// Unsafe: see comment in Server Http1Transaction, above.
|
||||
let mut headers_indices: [HeaderIndices; MAX_HEADERS] = unsafe { mem::uninitialized() };
|
||||
let (len, status, version, headers_len) = {
|
||||
let mut headers: [httparse::Header; MAX_HEADERS] = unsafe { mem::uninitialized() };
|
||||
let mut headers: [httparse::Header<'_>; MAX_HEADERS] = unsafe { mem::uninitialized() };
|
||||
trace!("Response.parse([Header; {}], [u8; {}])", headers.len(), buf.len());
|
||||
let mut res = httparse::Response::new(&mut headers);
|
||||
let bytes = buf.as_ref();
|
||||
@@ -666,7 +665,7 @@ impl Http1Transaction for Client {
|
||||
}
|
||||
}
|
||||
|
||||
fn encode(msg: Encode<Self::Outgoing>, dst: &mut Vec<u8>) -> crate::Result<Encoder> {
|
||||
fn encode(msg: Encode<'_, Self::Outgoing>, dst: &mut Vec<u8>) -> crate::Result<Encoder> {
|
||||
trace!("Client::encode method={:?}, body={:?}", msg.head.subject.0, msg.body);
|
||||
|
||||
*msg.req_method = Some(msg.head.subject.0.clone());
|
||||
@@ -935,7 +934,7 @@ struct HeaderIndices {
|
||||
|
||||
fn record_header_indices(
|
||||
bytes: &[u8],
|
||||
headers: &[httparse::Header],
|
||||
headers: &[httparse::Header<'_>],
|
||||
indices: &mut [HeaderIndices]
|
||||
) -> Result<(), crate::error::Parse> {
|
||||
let bytes_ptr = bytes.as_ptr() as usize;
|
||||
@@ -1044,7 +1043,7 @@ impl<'a> fmt::Write for FastWrite<'a> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn write_fmt(&mut self, args: fmt::Arguments) -> fmt::Result {
|
||||
fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> fmt::Result {
|
||||
fmt::write(self, args)
|
||||
}
|
||||
}
|
||||
@@ -1062,7 +1061,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_parse_request() {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
let mut raw = BytesMut::from(b"GET /echo HTTP/1.1\r\nHost: hyper.rs\r\n\r\n".to_vec());
|
||||
let mut method = None;
|
||||
@@ -1082,7 +1080,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_parse_response() {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
let mut raw = BytesMut::from(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n".to_vec());
|
||||
let ctx = ParseContext {
|
||||
|
||||
@@ -94,7 +94,7 @@ mod body_length {
|
||||
}
|
||||
|
||||
impl fmt::Display for DecodedLength {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
DecodedLength::CLOSE_DELIMITED => f.write_str("close-delimited"),
|
||||
DecodedLength::CHUNKED => f.write_str("chunked encoding"),
|
||||
|
||||
@@ -17,7 +17,6 @@ use std::sync::Arc;
|
||||
|
||||
use bytes::Bytes;
|
||||
use futures_core::Stream;
|
||||
use h2;
|
||||
use pin_utils::{unsafe_pinned, unsafe_unpinned};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
#[cfg(feature = "runtime")] use tokio_net::driver::Handle;
|
||||
@@ -666,7 +665,7 @@ impl<I, S> fmt::Debug for Connection<I, S>
|
||||
where
|
||||
S: Service<Body>,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Connection")
|
||||
.finish()
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ where
|
||||
}
|
||||
|
||||
impl<I: fmt::Debug, S: fmt::Debug> fmt::Debug for Server<I, S> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Server")
|
||||
.field("listener", &self.spawn_all.incoming_ref())
|
||||
.finish()
|
||||
|
||||
@@ -182,7 +182,7 @@ fn is_connection_error(e: &io::Error) -> bool {
|
||||
}
|
||||
|
||||
impl fmt::Debug for AddrIncoming {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("AddrIncoming")
|
||||
.field("addr", &self.addr)
|
||||
.field("sleep_on_errors", &self.sleep_on_errors)
|
||||
|
||||
@@ -201,7 +201,7 @@ where
|
||||
}
|
||||
|
||||
impl<F> fmt::Debug for MakeServiceFn<F> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("MakeServiceFn")
|
||||
.finish()
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ where
|
||||
}
|
||||
|
||||
impl<F, R> fmt::Debug for ServiceFn<F, R> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("impl Service")
|
||||
.finish()
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ impl AsyncWrite for Upgraded {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Upgraded {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Upgraded")
|
||||
.finish()
|
||||
}
|
||||
@@ -198,7 +198,7 @@ impl Future for OnUpgrade {
|
||||
}
|
||||
|
||||
impl fmt::Debug for OnUpgrade {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("OnUpgrade")
|
||||
.finish()
|
||||
}
|
||||
@@ -223,7 +223,7 @@ impl Pending {
|
||||
// ===== impl UpgradeExpected =====
|
||||
|
||||
impl fmt::Display for UpgradeExpected {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(self.description())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
#![deny(warnings)]
|
||||
extern crate bytes;
|
||||
extern crate hyper;
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
#[macro_use] extern crate matches;
|
||||
extern crate net2;
|
||||
extern crate pretty_env_logger;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
extern crate tokio_net;
|
||||
extern crate tokio_timer;
|
||||
|
||||
use std::io::{Read, Write};
|
||||
use std::net::{SocketAddr, TcpListener};
|
||||
@@ -777,9 +771,6 @@ mod dispatch_impl {
|
||||
|
||||
use hyper::client::connect::{Connect, Connected, Destination, HttpConnector};
|
||||
use hyper::Client;
|
||||
use hyper;
|
||||
|
||||
|
||||
|
||||
#[test]
|
||||
fn drop_body_before_eof_closes_connection() {
|
||||
@@ -1609,7 +1600,7 @@ mod dispatch_impl {
|
||||
impl AsyncRead for DebugStream {
|
||||
fn poll_read(
|
||||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context,
|
||||
cx: &mut Context<'_>,
|
||||
buf: &mut [u8],
|
||||
) -> Poll<Result<usize, io::Error>> {
|
||||
Pin::new(&mut self.0).poll_read(cx, buf)
|
||||
@@ -2171,7 +2162,7 @@ mod conn {
|
||||
impl AsyncRead for DebugStream {
|
||||
fn poll_read(
|
||||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context,
|
||||
cx: &mut Context<'_>,
|
||||
buf: &mut [u8],
|
||||
) -> Poll<Result<usize, io::Error>> {
|
||||
Pin::new(&mut self.tcp).poll_read(cx, buf)
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
#![feature(async_closure)]
|
||||
#![deny(warnings)]
|
||||
extern crate http;
|
||||
extern crate hyper;
|
||||
extern crate h2;
|
||||
extern crate net2;
|
||||
extern crate spmc;
|
||||
extern crate pretty_env_logger;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
extern crate tokio_net;
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use std::net::{TcpStream, Shutdown, SocketAddr};
|
||||
use std::io::{self, Read, Write};
|
||||
@@ -1241,7 +1233,7 @@ fn http_connect() {
|
||||
|
||||
#[test]
|
||||
fn upgrades_new() {
|
||||
use crate::tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
|
||||
let _ = pretty_env_logger::try_init();
|
||||
let mut rt = Runtime::new().unwrap();
|
||||
@@ -1765,7 +1757,7 @@ impl Serve {
|
||||
Ok(buf)
|
||||
}
|
||||
|
||||
fn reply(&self) -> ReplyBuilder {
|
||||
fn reply(&self) -> ReplyBuilder<'_> {
|
||||
ReplyBuilder {
|
||||
tx: &self.reply_tx
|
||||
}
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
pub extern crate hyper;
|
||||
pub extern crate tokio;
|
||||
extern crate futures_util;
|
||||
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::sync::{Arc, Mutex, atomic::{AtomicUsize, Ordering}};
|
||||
use std::time::{Duration/*, Instant*/};
|
||||
|
||||
use crate::hyper::{Body, Client, Request, Response, Server, Version};
|
||||
use crate::hyper::client::HttpConnector;
|
||||
use crate::hyper::service::{make_service_fn, service_fn};
|
||||
use hyper::{Body, Client, Request, Response, Server, Version};
|
||||
use hyper::client::HttpConnector;
|
||||
use hyper::service::{make_service_fn, service_fn};
|
||||
|
||||
pub use std::net::SocketAddr;
|
||||
pub use self::futures_util::{future, try_future, FutureExt as _, StreamExt as _, TryFutureExt as _, TryStreamExt as _};
|
||||
pub use futures_util::{future, try_future, FutureExt as _, StreamExt as _, TryFutureExt as _, TryStreamExt as _};
|
||||
//pub use self::futures_channel::oneshot;
|
||||
pub use self::hyper::{HeaderMap, StatusCode};
|
||||
pub use self::tokio::runtime::current_thread::Runtime;
|
||||
pub use hyper::{HeaderMap, StatusCode};
|
||||
pub use tokio::runtime::current_thread::Runtime;
|
||||
|
||||
macro_rules! t {
|
||||
(
|
||||
@@ -209,12 +205,12 @@ macro_rules! __internal_headers_map {
|
||||
|
||||
macro_rules! __internal_headers_eq {
|
||||
(@pat $name: expr, $pat:pat) => {
|
||||
::std::sync::Arc::new(move |__hdrs: &crate::hyper::HeaderMap| {
|
||||
::std::sync::Arc::new(move |__hdrs: &hyper::HeaderMap| {
|
||||
match __hdrs.get($name) {
|
||||
$pat => (),
|
||||
other => panic!("headers[{}] was not {}: {:?}", stringify!($name), stringify!($pat), other),
|
||||
}
|
||||
}) as ::std::sync::Arc<dyn Fn(&crate::hyper::HeaderMap) + Send + Sync>
|
||||
}) as ::std::sync::Arc<dyn Fn(&hyper::HeaderMap) + Send + Sync>
|
||||
};
|
||||
(@val $name: expr, NONE) => {
|
||||
__internal_headers_eq!(@pat $name, None);
|
||||
@@ -224,13 +220,13 @@ macro_rules! __internal_headers_eq {
|
||||
};
|
||||
(@val $name: expr, $val:expr) => ({
|
||||
let __val = Option::from($val);
|
||||
::std::sync::Arc::new(move |__hdrs: &crate::hyper::HeaderMap| {
|
||||
::std::sync::Arc::new(move |__hdrs: &hyper::HeaderMap| {
|
||||
if let Some(ref val) = __val {
|
||||
assert_eq!(__hdrs.get($name).expect(stringify!($name)), val.to_string().as_str(), stringify!($name));
|
||||
} else {
|
||||
assert_eq!(__hdrs.get($name), None, stringify!($name));
|
||||
}
|
||||
}) as ::std::sync::Arc<dyn Fn(&crate::hyper::HeaderMap) + Send + Sync>
|
||||
}) as ::std::sync::Arc<dyn Fn(&hyper::HeaderMap) + Send + Sync>
|
||||
});
|
||||
($headers:ident, { $($name:expr => $val:tt,)* }) => {
|
||||
$(
|
||||
@@ -306,7 +302,6 @@ pub struct __TestConfig {
|
||||
}
|
||||
|
||||
pub fn __run_test(cfg: __TestConfig) {
|
||||
extern crate pretty_env_logger;
|
||||
let _ = pretty_env_logger::try_init();
|
||||
let mut rt = Runtime::new().expect("new rt");
|
||||
|
||||
@@ -379,7 +374,7 @@ pub fn __run_test(cfg: __TestConfig) {
|
||||
let fut = connecting
|
||||
.then(|res| res.expect("connecting"))
|
||||
.map(|conn_res| conn_res.expect("server connection error"));
|
||||
crate::tokio::spawn(fut);
|
||||
tokio::spawn(fut);
|
||||
future::ok::<_, hyper::Error>(cnt)
|
||||
})
|
||||
.map(|res| {
|
||||
|
||||
Reference in New Issue
Block a user