Repository: seanmonstar/reqwest (language: rust)

Issue:
Tests fail when run with `--all-features`
On current master (`797df2b96a88ee49a636337f87beebe87f6212fe`) with Rust 1.82 (`rustc 1.82.0 (f6e511eec 2024-10-15)`, `cargo 1.82.0 (8f40fc59f 2024-08-21)`), although a regular run of `cargo test` works fine, attempting to run `RUSTFLAGS='--cfg reqwest_unstable' cargo test --all-features --tests` fails with the following errors (which would have just warnings if not escalated by `deny` directives):

<details><summary>Errors</summary>

```
warning: variable does not need to be mutable
   --> src/blocking/client.rs:619:20
    |
619 |     pub fn add_crl(mut self, crl: CertificateRevocationList) -> ClientBuilder {
    |                    ----^^^^
    |                    |
    |                    help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

warning: variable does not need to be mutable
   --> src/blocking/client.rs:632:9
    |
632 |         mut self,
    |         ----^^^^
    |         |
    |         help: remove this `mut`

error: variable does not need to be mutable
   --> src/blocking/client.rs:619:20
    |
619 |     pub fn add_crl(mut self, crl: CertificateRevocationList) -> ClientBuilder {
    |                    ----^^^^
    |                    |
    |                    help: remove this `mut`
    |
note: the lint level is defined here
   --> src/lib.rs:4:24
    |
4   | #![cfg_attr(test, deny(warnings))]
    |                        ^^^^^^^^
    = note: `#[deny(unused_mut)]` implied by `#[deny(warnings)]`

error: variable does not need to be mutable
   --> src/blocking/client.rs:632:9
    |
632 |         mut self,
    |         ----^^^^
    |         |
    |         help: remove this `mut`

error: could not compile `reqwest` (lib test) due to 2 previous errors
```

</details>

Those errors can be fixed with the following diff:

<details><summary>Diff</summary>

```diff
diff --git a/src/blocking/client.rs b/src/blocking/client.rs
index 7b5caff..4db9e42 100644
--- a/src/blocking/client.rs
+++ b/src/blocking/client.rs
@@ -616,7 +616,7 @@ impl ClientBuilder {
     /// This requires the `rustls-tls(-...)` Cargo feature enabled.
     #[cfg(feature = "__rustls")]
     #[cfg_attr(docsrs, doc(cfg(feature = "rustls-tls")))]
-    pub fn add_crl(mut self, crl: CertificateRevocationList) -> ClientBuilder {
+    pub fn add_crl(self, crl: CertificateRevocationList) -> ClientBuilder {
         self.with_inner(move |inner| inner.add_crl(crl))
     }
 
@@ -629,7 +629,7 @@ impl ClientBuilder {
     #[cfg(feature = "__rustls")]
     #[cfg_attr(docsrs, doc(cfg(feature = "rustls-tls")))]
     pub fn add_crls(
-        mut self,
+        self,
         crls: impl IntoIterator<Item = CertificateRevocationList>,
     ) -> ClientBuilder {
         self.with_inner(move |inner| inner.add_crls(crls))
```

</details>

However, this still results in a failure of the `async_impl_file_part` test:

```
---- async_impl_file_part stdout ----
thread 'test(async_impl_file_part)-support-server' panicked at tests/multipart.rs:211:37:
no entry found for key "transfer-encoding"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'async_impl_file_part' panicked at tests/multipart.rs:228:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: "http://127.0.0.1:43241/multipart/3", source: hyper_util::client::legacy::Error(SendRequest, hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" })) }
```

That test was added in [`cc3dd510c0cb50ee03be217ea864d84e744658d1`](https://github.com/gretchenfrage/reqwest/commit/cc3dd510c0cb50ee03be217ea864d84e744658d1) ("Add file function to async::multipart (#2106)", Aug/31/2024), which is currently `master~14`. In that commit, running `RUSTFLAGS='--cfg reqwest_unstable' cargo test --all-features --tests` does not error.

It is at commit [`aba01ff7df33a3f29e3f7fdbd24ee90390276335`](https://github.com/seanmonstar/reqwest/commit/aba01ff7df33a3f29e3f7fdbd24ee90390276335) ("feat: Add support for Certificate Revocation Lists (#2433)", Oct/18/2024), which is currently `master~4`, that the _compilation_ error appears when running the tests. However, as of that commit, if the compilation error is patched, the tests do not error.

It it as commit [`598f8574cb428bb03b487e0abfd8169a594dd2db`](https://github.com/seanmonstar/reqwest/commit/598f8574cb428bb03b487e0abfd8169a594dd2db) ("Add content length to async_impl::multipart file streams (#2459)", Oct/27/2024), which is currently `master~2`, that the test failure appears even with the patched test.




Discussion / hints:

Fix patch:
diff --git a/src/blocking/client.rs b/src/blocking/client.rs
index fe7574689..a8c5319b4 100644
--- a/src/blocking/client.rs
+++ b/src/blocking/client.rs
@@ -625,7 +625,7 @@ impl ClientBuilder {
     /// This requires the `rustls-tls(-...)` Cargo feature enabled.
     #[cfg(feature = "__rustls")]
     #[cfg_attr(docsrs, doc(cfg(feature = "rustls-tls")))]
-    pub fn add_crl(mut self, crl: CertificateRevocationList) -> ClientBuilder {
+    pub fn add_crl(self, crl: CertificateRevocationList) -> ClientBuilder {
         self.with_inner(move |inner| inner.add_crl(crl))
     }
 
@@ -638,7 +638,7 @@ impl ClientBuilder {
     #[cfg(feature = "__rustls")]
     #[cfg_attr(docsrs, doc(cfg(feature = "rustls-tls")))]
     pub fn add_crls(
-        mut self,
+        self,
         crls: impl IntoIterator<Item = CertificateRevocationList>,
     ) -> ClientBuilder {
         self.with_inner(move |inner| inner.add_crls(crls))


Test patch: