|
| 1 | +# PR #540 Review Responses |
| 2 | + |
| 3 | +## Comment 1 — `is_https()`: replace `#[allow(dead_code)]` with cfg-gate |
| 4 | +**Reviewer:** tnull |
| 5 | +**File:** `bitreq/src/url.rs:386` |
| 6 | +**Request:** Apply `#[cfg(all(feature = "proxy", feature = "std"))]` instead of `#[allow(dead_code)]`. |
| 7 | + |
| 8 | +**Response:** Agree with the spirit — `allow(dead_code)` was the wrong approach and a cfg-gate |
| 9 | +is better. However, `is_https()` is used not only under `cfg(all(feature = "proxy", feature = "std"))` but also under `cfg(feature = "std")` in `ConnectionParams::from_request` (request.rs). The narrower gate the reviewer suggested would break that usage. Applied `#[cfg(feature = "std")]` instead, which covers both call-sites and the tests (which are also `cfg(test, feature = "std")`). |
| 10 | + |
| 11 | +**Change:** Replaced `#[allow(dead_code)]` with `#[cfg(feature = "std")]` on `is_https()`. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Comment 2 — `path_and_query()`: replace `#[allow(dead_code)]` with cfg-gate |
| 16 | +**Reviewer:** tnull |
| 17 | +**File:** `bitreq/src/url.rs:405` |
| 18 | +**Request:** cfg-gate on `std` rather than allowing dead code. |
| 19 | + |
| 20 | +**Response:** Fully agree. `path_and_query()` is only called from `get_http_head()` (gated on `std`) and from tests (gated on `cfg(all(test, feature = "std"))`). |
| 21 | + |
| 22 | +**Change:** Replaced `#[allow(dead_code)]` with `#[cfg(feature = "std")]` on `path_and_query()`. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Comment 3 — `webpki-roots` cfg rename: expand why it's necessary |
| 27 | +**Reviewer:** tnull |
| 28 | +**File:** `bitreq/src/connection/rustls_stream.rs:25` |
| 29 | +**Request:** Explain why `rustls-webpki` was renamed to `webpki-roots`. |
| 30 | + |
| 31 | +**Response:** This is a bug-fix, not a behavior change. The import |
| 32 | +`use webpki_roots::TLS_SERVER_ROOTS;` comes from the `webpki-roots` crate (dependency name |
| 33 | +`webpki-roots` in Cargo.toml). The old cfg `feature = "rustls-webpki"` referenced a *different* |
| 34 | +dependency (`rustls-webpki`, the verification library). Since `https-rustls` enables both |
| 35 | +`webpki-roots` and `rustls-webpki` features, the gate happened to work in practice, but it was |
| 36 | +checking the wrong feature. The rename makes the gate match the crate that provides the symbol. |
| 37 | + |
| 38 | +No code change needed — this is an explanation only. |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## Comment 4 — DRY up duplicate `use super::{AsyncHttpStream, AsyncTcpStream}` |
| 43 | +**Reviewer:** tnull |
| 44 | +**File:** `bitreq/src/connection/rustls_stream.rs:36` |
| 45 | +**Request:** Deduplicate the two identical import lines with different cfg gates. |
| 46 | + |
| 47 | +**Response:** Agree. Merged the two cfg-gated imports into a single import using `any()`: |
| 48 | +```rust |
| 49 | +#[cfg(all( |
| 50 | + feature = "async", |
| 51 | + any( |
| 52 | + feature = "tokio-rustls", |
| 53 | + all(feature = "native-tls", not(feature = "rustls"), feature = "tokio-native-tls") |
| 54 | + ) |
| 55 | +))] |
| 56 | +use super::{AsyncHttpStream, AsyncTcpStream}; |
| 57 | +``` |
| 58 | +This factors out the common `feature = "async"` requirement and uses `any()` for the two |
| 59 | +backend alternatives. |
| 60 | + |
| 61 | +**Change:** Replaced two duplicate imports with a single `any()`-based cfg gate. |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## Comment 5 — Dropping `msrv` from `clippy.toml` |
| 66 | +**Reviewer:** tnull |
| 67 | +**File:** `clippy.toml:1` |
| 68 | +**Request:** Why remove the msrv? Will clippy still respect the MSRV? |
| 69 | + |
| 70 | +**Response:** Since Rust 1.74, clippy reads `rust-version` from `Cargo.toml` automatically, so |
| 71 | +the explicit `clippy.toml` setting is technically redundant (all crates in the workspace already |
| 72 | +declare `rust-version = "1.75.0"`). However, keeping it doesn't hurt and serves as a clear, |
| 73 | +explicit safety net. Restored it to avoid any ambiguity. |
| 74 | + |
| 75 | +**Change:** Restored `msrv = "1.75.0"` in `clippy.toml`. |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## Comment 6 — Where is the `msrv` toolchain defined? |
| 80 | +**Reviewer:** tnull |
| 81 | +**File:** `.github/workflows/rust.yaml:31` |
| 82 | +**Request:** Where is the msrv toolchain defined? Concern about per-crate MSRV divergence. |
| 83 | + |
| 84 | +**Response:** The MSRV toolchain is defined in `Cargo.toml` at `[workspace.metadata.rbmt.toolchains] msrv = "1.75.0"`. `cargo rbmt` reads this value and installs/selects that toolchain when `--toolchain msrv` is passed. Currently all crates in the workspace share the same MSRV (1.75.0), so a single workspace-level value is correct. If crate MSRVs diverge in the future (e.g. bitreq's TLS deps bump MSRV), rbmt supports per-crate MSRV overrides via `[package.metadata.rbmt.toolchains]` — but there's no need for that yet. No code change for this item. |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## Changelog |
| 89 | + |
| 90 | +1. `bitreq/src/url.rs` — `is_https()`: `#[allow(dead_code)]` → `#[cfg(feature = "std")]` |
| 91 | +2. `bitreq/src/url.rs` — `path_and_query()`: `#[allow(dead_code)]` → `#[cfg(feature = "std")]` |
| 92 | +3. `bitreq/src/connection/rustls_stream.rs` — DRY: merged two duplicate `use super::{AsyncHttpStream, AsyncTcpStream}` imports into one with an `any()` cfg gate |
| 93 | +4. `clippy.toml` — Restored `msrv = "1.75.0"` |
0 commit comments