Repository: blackbeam/rust-mysql-simple (language: rust)

Issue:
Pkcs1 debug messages output on screen
In mysql-25.0.1 code was added to the rustls_opts.rc file (line 91) that returns a debug message vs the priv key.  
```
 90         if let Some(priv_key) = priv_key {
 91             return Ok((cert_chain, dbg!(priv_key)));
 92         }   
```
So now when running I get the following message repeated multiple times
```
[/home/someuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mysql-25.0.1/src/conn/opts/rustls_opts.rs:91:36] priv_key = Pkcs1(
    PrivatePkcs1KeyDer(
        "[secret key elided]",
    ),
)
```
I fixed it by removing the debug and just returning the priv_key or I guess I could remove the entire if statement as the default returns the cert_chain, priv_key. 

Is there a reason this was done?



Discussion / hints:

Fix patch:
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index cfc3a7f..5d5cdf9 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -29,6 +29,10 @@ jobs:
           cargo fmt -- --check
         condition: and(succeeded(), eq(variables['installRust.toolchain'], 'stable'))
         displayName: cargo fmt
+      - bash: |
+          cargo clippy -- -Dclippy::dbg_macro -Dclippy::todo
+        condition: and(succeeded(), eq(variables['installRust.toolchain'], 'stable'))
+        displayName: lint
       - bash: |
           cargo check
           cargo check --no-default-features --features default-rustls
@@ -37,7 +41,7 @@ jobs:
 
   - job: "TestBasicMacOs"
     pool:
-      vmImage: "macOS-11"
+      vmImage: "macOS-13"
     strategy:
       maxParallel: 10
       matrix:
diff --git a/src/conn/mod.rs b/src/conn/mod.rs
index e8a9fed..5ab037d 100644
--- a/src/conn/mod.rs
+++ b/src/conn/mod.rs
@@ -2386,10 +2386,7 @@ mod test {
                     }
 
                     for (name, value) in expected_values {
-                        assert_eq!(
-                            actual_values.get(&name.to_string()),
-                            Some(&value.to_string())
-                        );
+                        assert_eq!(actual_values.get(*name), Some(&value.to_string()));
                     }
                 }
 
diff --git a/src/conn/opts/mod.rs b/src/conn/opts/mod.rs
index e78afe4..43a5ff4 100644
--- a/src/conn/opts/mod.rs
+++ b/src/conn/opts/mod.rs
@@ -808,8 +808,7 @@ impl OptsBuilder {
     /// Note that it'll saturate to proper minimum and maximum values
     /// for this parameter (see MySql documentation).
     pub fn max_allowed_packet(mut self, max_allowed_packet: Option<usize>) -> Self {
-        self.opts.0.max_allowed_packet =
-            max_allowed_packet.map(|x| std::cmp::max(1024, std::cmp::min(1073741824, x)));
+        self.opts.0.max_allowed_packet = max_allowed_packet.map(|x| x.clamp(1024, 1073741824));
         self
     }
 
diff --git a/src/conn/opts/rustls_opts.rs b/src/conn/opts/rustls_opts.rs
index 95f2fc4..3acae9f 100644
--- a/src/conn/opts/rustls_opts.rs
+++ b/src/conn/opts/rustls_opts.rs
@@ -88,7 +88,7 @@ impl ClientIdentity {
         }
 
         if let Some(priv_key) = priv_key {
-            return Ok((cert_chain, dbg!(priv_key)));
+            return Ok((cert_chain, priv_key));
         }
 
         match PrivateKeyDer::try_from(key_data.as_slice()) {
diff --git a/src/io/mod.rs b/src/io/mod.rs
index 77703d8..ae2ff96 100644
--- a/src/io/mod.rs
+++ b/src/io/mod.rs
@@ -90,6 +90,7 @@ impl Stream {
         unimplemented!("Sockets is not implemented on current platform");
     }
 
+    #[allow(clippy::too_many_arguments)]
     pub fn connect_tcp(
         ip_or_hostname: &str,
         port: u16,
@@ -166,7 +167,7 @@ pub enum TcpStream {
     #[cfg(feature = "native-tls")]
     Secure(BufStream<native_tls::TlsStream<net::TcpStream>>),
     #[cfg(feature = "rustls")]
-    Secure(BufStream<rustls::StreamOwned<rustls::ClientConnection, net::TcpStream>>),
+    Secure(BufStream<Box<rustls::StreamOwned<rustls::ClientConnection, net::TcpStream>>>),
     Insecure(BufStream<net::TcpStream>),
 }
 
diff --git a/src/io/tls/rustls_io.rs b/src/io/tls/rustls_io.rs
index 1625ca2..54f9243 100644
--- a/src/io/tls/rustls_io.rs
+++ b/src/io/tls/rustls_io.rs
@@ -92,7 +92,7 @@ impl Stream {
                         rustls::ClientConnection::new(Arc::new(config), server_name).unwrap();
                     let secure_stream = rustls::StreamOwned::new(conn, inner);
                     Ok(Stream::TcpStream(TcpStream::Secure(BufStream::new(
-                        secure_stream,
+                        Box::new(secure_stream),
                     ))))
                 }
                 TcpStream::Secure(_) => Ok(Stream::TcpStream(tcp_stream)),


Test patch: