Skip to content

Commit 6461dad

Browse files
committed
Clippy
1 parent 7bfa50a commit 6461dad

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

src/agent-client-protocol/src/jsonrpc.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,10 @@ struct ResponderCancellation;
14911491

14921492
#[cfg(feature = "unstable_cancel_request")]
14931493
impl RequestCancellationRegistry {
1494+
fn new() -> Self {
1495+
Self::default()
1496+
}
1497+
14941498
fn register(&self, id: serde_json::Value) -> ResponderCancellation {
14951499
let cancellation = RequestCancellation::new();
14961500
self.inner
@@ -1536,10 +1540,23 @@ impl RequestCancellationRegistry {
15361540

15371541
#[cfg(not(feature = "unstable_cancel_request"))]
15381542
impl RequestCancellationRegistry {
1543+
fn new() -> Self {
1544+
Self
1545+
}
1546+
1547+
#[expect(
1548+
clippy::unused_self,
1549+
reason = "feature-disabled stub mirrors the real registry API"
1550+
)]
15391551
fn register(&self, _id: serde_json::Value) -> ResponderCancellation {
15401552
ResponderCancellation
15411553
}
15421554

1555+
#[expect(
1556+
clippy::unused_self,
1557+
clippy::unnecessary_wraps,
1558+
reason = "feature-disabled stub mirrors the real registry API"
1559+
)]
15431560
fn cancel_if_requested(&self, _dispatch: &Dispatch) -> Result<bool, crate::Error> {
15441561
Ok(false)
15451562
}
@@ -2319,6 +2336,7 @@ impl<T: JsonRpcResponse> Responder<T> {
23192336
///
23202337
/// [`Error::request_cancelled`]: crate::Error::request_cancelled
23212338
#[cfg(feature = "unstable_cancel_request")]
2339+
#[must_use]
23222340
pub fn cancellation(&self) -> RequestCancellation {
23232341
self.cancellation.cancellation()
23242342
}

src/agent-client-protocol/src/jsonrpc/incoming_actor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub(super) async fn incoming_protocol_actor<Counterpart: Role>(
6262
FxHashMap::default();
6363
let mut pending_messages: Vec<Dispatch> = vec![];
6464

65-
let request_cancellations = super::RequestCancellationRegistry::default();
65+
let request_cancellations = super::RequestCancellationRegistry::new();
6666

6767
// Map from request ID to (method, sender) for response dispatch.
6868
// Keys are JSON values because jsonrpcmsg::Id doesn't implement Eq.

src/agent-client-protocol/tests/jsonrpc_request_cancellation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl JsonRpcMessage for SimpleRequest {
5858
method == "simple_method"
5959
}
6060

61-
fn method(&self) -> &str {
61+
fn method(&self) -> &'static str {
6262
"simple_method"
6363
}
6464

0 commit comments

Comments
 (0)