style(lib): use just std instead of ::std in paths (#2101)

This commit is contained in:
Linus Färnstrand
2020-01-29 19:25:57 +01:00
committed by GitHub
parent c4bb4db5c2
commit de7418da2f
14 changed files with 32 additions and 32 deletions

View File

@@ -136,7 +136,7 @@ impl Body {
///
/// ```
/// # use hyper::Body;
/// let chunks: Vec<Result<_, ::std::io::Error>> = vec![
/// let chunks: Vec<Result<_, std::io::Error>> = vec![
/// Ok("hello"),
/// Ok(" "),
/// Ok("world"),

View File

@@ -692,7 +692,7 @@ mod tests {
let local_timeout = Duration::default();
let unreachable_v4_timeout = measure_connect(unreachable_ipv4_addr()).1;
let unreachable_v6_timeout = measure_connect(unreachable_ipv6_addr()).1;
let fallback_timeout = ::std::cmp::max(unreachable_v4_timeout, unreachable_v6_timeout)
let fallback_timeout = std::cmp::max(unreachable_v4_timeout, unreachable_v6_timeout)
+ Duration::from_millis(250);
let scenarios = &[
@@ -849,7 +849,7 @@ mod tests {
fn measure_connect(addr: IpAddr) -> (bool, Duration) {
let start = Instant::now();
let result =
::std::net::TcpStream::connect_timeout(&(addr, 80).into(), Duration::from_secs(1));
std::net::TcpStream::connect_timeout(&(addr, 80).into(), Duration::from_secs(1));
let reachable = result.is_ok() || result.unwrap_err().kind() == io::ErrorKind::TimedOut;
let duration = start.elapsed();

View File

@@ -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().expect("enabled").lock().expect("lock")
}
@@ -902,7 +902,7 @@ mod tests {
super::Config {
enabled: true,
keep_alive_timeout: Some(Duration::from_millis(10)),
max_idle_per_host: ::std::usize::MAX,
max_idle_per_host: std::usize::MAX,
},
&Exec::Default,
);

View File

@@ -51,7 +51,7 @@ fn retryable_request() {
try_ready!(sock1.read(&mut [0u8; 512]));
try_ready!(sock1.write(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"));
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv1 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv1 poll_fn error: {}", e));
rt.block_on(res1.join(srv1)).expect("res1");
}
drop(sock1);
@@ -68,7 +68,7 @@ fn retryable_request() {
try_ready!(sock2.read(&mut [0u8; 512]));
try_ready!(sock2.write(b"HTTP/1.1 222 OK\r\nContent-Length: 0\r\n\r\n"));
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv2 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv2 poll_fn error: {}", e));
rt.block_on(res2.join(srv2)).expect("res2");
}
@@ -97,7 +97,7 @@ fn conn_reset_after_write() {
try_ready!(sock1.read(&mut [0u8; 512]));
try_ready!(sock1.write(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"));
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv1 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv1 poll_fn error: {}", e));
rt.block_on(res1.join(srv1)).expect("res1");
}
@@ -117,7 +117,7 @@ fn conn_reset_after_write() {
try_ready!(sock1.as_mut().unwrap().read(&mut [0u8; 512]));
sock1.take();
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv2 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv2 poll_fn error: {}", e));
let err = rt.block_on(res2.join(srv2)).expect_err("res2");
assert!(err.is_incomplete_message(), "{:?}", err);
}
@@ -159,7 +159,7 @@ fn checkout_win_allows_connect_future_to_be_pooled() {
0\r\n\r\n\
"));
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv1 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv1 poll_fn error: {}", e));
rt.block_on(res1.join(srv1)).expect("res1").0
};
@@ -177,7 +177,7 @@ fn checkout_win_allows_connect_future_to_be_pooled() {
try_ready!(sock1.read(&mut [0u8; 512]));
try_ready!(sock1.write(b"HTTP/1.1 200 OK\r\nConnection: close\r\n\r\nx"));
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv2 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv2 poll_fn error: {}", e));
rt.block_on(res2.join(drain).join(srv2)).expect("res2");
}
@@ -214,7 +214,7 @@ fn checkout_win_allows_connect_future_to_be_pooled() {
try_ready!(sock2.read(&mut [0u8; 512]));
try_ready!(sock2.write(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"));
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv3 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv3 poll_fn error: {}", e));
rt.block_on(res3.join(srv3)).expect("res3");
}
@@ -247,7 +247,7 @@ fn bench_http1_get_0b(b: &mut test::Bencher) {
try_ready!(sock1.read(&mut [0u8; 512]));
try_ready!(sock1.write(b"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"));
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv1 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv1 poll_fn error: {}", e));
rt.block_on(res1.join(srv1)).expect("res1");
});
}
@@ -279,7 +279,7 @@ fn bench_http1_get_10b(b: &mut test::Bencher) {
try_ready!(sock1.read(&mut [0u8; 512]));
try_ready!(sock1.write(b"HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\n0123456789"));
Ok(Async::Ready(()))
}).map_err(|e: ::std::io::Error| panic!("srv1 poll_fn error: {}", e));
}).map_err(|e: std::io::Error| panic!("srv1 poll_fn error: {}", e));
rt.block_on(res1.join(srv1)).expect("res1");
});
}

View File

@@ -1,8 +1,8 @@
macro_rules! ready {
($e:expr) => {
match $e {
::std::task::Poll::Ready(v) => v,
::std::task::Poll::Pending => return ::std::task::Poll::Pending,
std::task::Poll::Ready(v) => v,
std::task::Poll::Pending => return std::task::Poll::Pending,
}
};
}

View File

@@ -4,7 +4,7 @@ use std::fmt;
use std::io;
/// Result type often returned from methods that can have hyper `Error`s.
pub type Result<T> = ::std::result::Result<T, Error>;
pub type Result<T> = std::result::Result<T, Error>;
type Cause = Box<dyn StdError + Send + Sync>;

View File

@@ -37,7 +37,7 @@ impl Duplex {
let mut inner = DuplexInner {
handle_read_task: None,
read: AsyncIo::new_buf(Vec::new(), 0),
write: AsyncIo::new_buf(Vec::new(), ::std::usize::MAX),
write: AsyncIo::new_buf(Vec::new(), std::usize::MAX),
};
inner.read.park_tasks(true);

View File

@@ -777,7 +777,7 @@ impl fmt::Debug for Writing {
}
}
impl ::std::ops::BitAndAssign<bool> for KA {
impl std::ops::BitAndAssign<bool> for KA {
fn bitand_assign(&mut self, enabled: bool) {
if !enabled {
trace!("remote disabling keep-alive");
@@ -1041,7 +1041,7 @@ mod tests {
conn.state.idle();
match conn.poll() {
Err(ref err) if err.kind() == ::std::io::ErrorKind::UnexpectedEof => {},
Err(ref err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {},
other => panic!("unexpected frame: {:?}", other)
}
}
@@ -1065,7 +1065,7 @@ mod tests {
conn.state.busy();
match conn.poll() {
Err(ref err) if err.kind() == ::std::io::ErrorKind::UnexpectedEof => {},
Err(ref err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {},
other => panic!("unexpected frame: {:?}", other)
}
Ok(())

View File

@@ -386,7 +386,7 @@ mod tests {
impl<'a> MemRead for &'a [u8] {
fn read_mem(&mut self, _: &mut task::Context<'_>, len: usize) -> Poll<io::Result<Bytes>> {
let n = ::std::cmp::min(len, self.len());
let n = std::cmp::min(len, self.len());
if n > 0 {
let (a, b) = self.split_at(n);
let buf = Bytes::copy_from_slice(a);

View File

@@ -278,7 +278,7 @@ where
{
fn read_mem(&mut self, cx: &mut task::Context<'_>, len: usize) -> Poll<io::Result<Bytes>> {
if !self.read_buf.is_empty() {
let n = ::std::cmp::min(len, self.read_buf.len());
let n = std::cmp::min(len, self.read_buf.len());
Poll::Ready(Ok(self.read_buf.split_to(n).freeze()))
} else {
let n = ready!(self.poll_read_from_io(cx))?;
@@ -773,7 +773,7 @@ mod tests {
}
let mut max = 8192;
while max < ::std::usize::MAX {
while max < std::usize::MAX {
fuzz(max);
max = (max / 2).saturating_mul(3);
}

View File

@@ -50,7 +50,7 @@ mod body_length {
#[derive(Clone, Copy, PartialEq, Eq)]
pub(crate) struct DecodedLength(u64);
const MAX_LEN: u64 = ::std::u64::MAX - 2;
const MAX_LEN: u64 = std::u64::MAX - 2;
impl DecodedLength {
pub(crate) const CLOSE_DELIMITED: DecodedLength = DecodedLength(::std::u64::MAX);