Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all-features flag to clippy. #667

Merged
merged 3 commits into from Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Expand Up @@ -85,7 +85,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets -- -D warnings
args: --all-features --all-targets -- -D warnings
- name: doc
run: cargo doc --no-deps --document-private-items
env:
Expand Down
4 changes: 2 additions & 2 deletions redis/src/aio/async_std.rs
Expand Up @@ -83,7 +83,7 @@ pub enum AsyncStd {
Tcp(AsyncStdWrapped<TcpStream>),
/// Represents an Async_std TLS encrypted TCP connection.
#[cfg(feature = "async-std-tls-comp")]
TcpTls(AsyncStdWrapped<TlsStream<TcpStream>>),
TcpTls(AsyncStdWrapped<Box<TlsStream<TcpStream>>>),
/// Represents an Async_std Unix connection.
#[cfg(unix)]
Unix(AsyncStdWrapped<UnixStream>),
Expand Down Expand Up @@ -167,7 +167,7 @@ impl RedisRuntime for AsyncStd {
Ok(tls_connector
.connect(hostname, tcp_stream)
.await
.map(|con| Self::TcpTls(AsyncStdWrapped::new(con)))?)
.map(|con| Self::TcpTls(AsyncStdWrapped::new(Box::new(con))))?)
}

#[cfg(unix)]
Expand Down
4 changes: 2 additions & 2 deletions redis/src/aio/tokio.rs
Expand Up @@ -29,7 +29,7 @@ pub(crate) enum Tokio {
Tcp(TcpStreamTokio),
/// Represents a Tokio TLS encrypted TCP connection
#[cfg(feature = "tokio-native-tls-comp")]
TcpTls(TlsStream<TcpStreamTokio>),
TcpTls(Box<TlsStream<TcpStreamTokio>>),
/// Represents a Tokio Unix connection.
#[cfg(unix)]
Unix(UnixStreamTokio),
Expand Down Expand Up @@ -114,7 +114,7 @@ impl RedisRuntime for Tokio {
Ok(tls_connector
.connect(hostname, TcpStreamTokio::connect(&socket_addr).await?)
.await
.map(Tokio::TcpTls)?)
.map(|con| Tokio::TcpTls(Box::new(con)))?)
}

#[cfg(unix)]
Expand Down
23 changes: 13 additions & 10 deletions redis/src/connection.rs
Expand Up @@ -298,7 +298,7 @@ struct UnixConnection {
enum ActualConnection {
Tcp(TcpConnection),
#[cfg(feature = "tls")]
TcpTls(TcpTlsConnection),
TcpTls(Box<TcpTlsConnection>),
#[cfg(unix)]
Unix(UnixConnection),
}
Expand Down Expand Up @@ -384,10 +384,10 @@ impl ActualConnection {
} else {
TlsConnector::new()?
};
let host: &str = &*host;
let addr = (host.as_str(), port);
let tls = match timeout {
None => {
let tcp = TcpStream::connect((host, port))?;
let tcp = TcpStream::connect(addr)?;
match tls_connector.connect(host, tcp) {
Ok(res) => res,
Err(e) => {
Expand All @@ -398,7 +398,7 @@ impl ActualConnection {
Some(timeout) => {
let mut tcp = None;
let mut last_error = None;
for addr in (host, port).to_socket_addrs()? {
for addr in (host.as_str(), port).to_socket_addrs()? {
match TcpStream::connect_timeout(&addr, timeout) {
Ok(l) => {
tcp = Some(l);
Expand All @@ -423,10 +423,10 @@ impl ActualConnection {
}
}
};
ActualConnection::TcpTls(TcpTlsConnection {
ActualConnection::TcpTls(Box::new(TcpTlsConnection {
reader: tls,
open: true,
})
}))
}
#[cfg(not(feature = "tls"))]
ConnectionAddr::TcpTls { .. } => {
Expand Down Expand Up @@ -500,7 +500,8 @@ impl ActualConnection {
reader.set_write_timeout(dur)?;
}
#[cfg(feature = "tls")]
ActualConnection::TcpTls(TcpTlsConnection { ref reader, .. }) => {
ActualConnection::TcpTls(ref boxed_tls_connection) => {
let reader = &(boxed_tls_connection.reader);
reader.get_ref().set_write_timeout(dur)?;
}
#[cfg(unix)]
Expand All @@ -517,7 +518,8 @@ impl ActualConnection {
reader.set_read_timeout(dur)?;
}
#[cfg(feature = "tls")]
ActualConnection::TcpTls(TcpTlsConnection { ref reader, .. }) => {
ActualConnection::TcpTls(ref boxed_tls_connection) => {
let reader = &(boxed_tls_connection.reader);
reader.get_ref().set_read_timeout(dur)?;
}
#[cfg(unix)]
Expand All @@ -532,7 +534,7 @@ impl ActualConnection {
match *self {
ActualConnection::Tcp(TcpConnection { open, .. }) => open,
#[cfg(feature = "tls")]
ActualConnection::TcpTls(TcpTlsConnection { open, .. }) => open,
ActualConnection::TcpTls(ref boxed_tls_connection) => boxed_tls_connection.open,
#[cfg(unix)]
ActualConnection::Unix(UnixConnection { open, .. }) => open,
}
Expand Down Expand Up @@ -790,7 +792,8 @@ impl Connection {
self.parser.parse_value(reader)
}
#[cfg(feature = "tls")]
ActualConnection::TcpTls(TcpTlsConnection { ref mut reader, .. }) => {
ActualConnection::TcpTls(ref mut boxed_tls_connection) => {
let reader = &mut boxed_tls_connection.reader;
self.parser.parse_value(reader)
}
#[cfg(unix)]
Expand Down