Fix clippy and compiler warnings across client and server crates#1629
Fix clippy and compiler warnings across client and server crates#1629merkle-maren wants to merge 2 commits intoparitytech:masterfrom
Conversation
core/src/client/mod.rs
Outdated
| /// Owned version of [`RawResponse`]. | ||
| pub type RawResponseOwned = RawResponse<'static>; | ||
|
|
||
| #[allow(dead_code)] |
There was a problem hiding this comment.
All of these #[allow(dead_code)]s I would guess (without checking myself) are feature flag related, and the relevant things should be hidden when the feature(s) they are used for aren't enabled, rather then ignored via dead_code (which might legitimately mean they aren't needed anywhere)
client/http-client/src/tests.rs
Outdated
|
|
||
| async fn run_batch_request_with_response<T: Send + DeserializeOwned + std::fmt::Debug + Clone + 'static>( | ||
| batch: BatchRequestBuilder<'_>, | ||
| batch: BatchRequestBuilder<'static>, |
There was a problem hiding this comment.
I would have thought that adding '_ fo the BatchResponse type would also work here, but the proper equivalent would be adding a 'a lifetime in the generic params and using that. Elided / unnamed lifetimes aren't the same as static lifetimes.
client/ws-client/src/tests.rs
Outdated
|
|
||
| async fn run_batch_request_with_response<T: Send + DeserializeOwned + std::fmt::Debug + Clone + 'static>( | ||
| batch: BatchRequestBuilder<'_>, | ||
| batch: BatchRequestBuilder<'static>, |
|
Removed all These trigger warnings on Open to a better approach if you know the exact cfg gate here. |
Warnings surfaced while working on #1628. Merging these separately - they're independent from that work and trivial to review on their own.
Changes
'afromprocess_connectionin the server crate.mismatched_lifetime_syntaxeswarnings inhttp-clientandws-clienttest helpers by using explicit'staticlifetimes consistently.core::clientfor types only used whenasync-clientorasync-wasm-clientfeatures are enabled (FrontToBack,BatchMessage,SubscriptionSender, etc.).Motivation
cargo clippyandcargo test -p jsonrpsee-http-clientproduced ~14 compiler warnings. Mix of an unused lifetime, inconsistent lifetime syntax, and dead code from types gated behind feature flags not active in all compilation contexts.Clean builds should be clean. Warnings that linger get ignored, and ignored warnings hide real problems.
Test plan
cargo clippy --all-targets --all-features— zero warnings.cargo test --features tls— zero warnings.