Skip to content

Commit 10c947e

Browse files
committed
fix(transport): satisfy nightly rustfmt and build test ServerInfo via ::new (#857)
- Wrap the synthetic-cancellation construction to match `cargo +nightly fmt`. - `ServerInfo` is `#[non_exhaustive]`; construct it in the test with `ServerInfo::new(..)` instead of a struct literal. Verified locally: `cargo +nightly fmt --all -- --check` clean and the regression test passes (disconnect cancels the in-flight request).
1 parent b6c93fa commit 10c947e

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

crates/rmcp/src/transport/streamable_http_server/session/local.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ impl<S> Drop for CancelOnDisconnect<S> {
242242
method: CancelledNotificationMethod,
243243
extensions: Default::default(),
244244
};
245-
let message =
246-
ClientJsonRpcMessage::notification(ClientNotification::CancelledNotification(cancelled));
245+
let message = ClientJsonRpcMessage::notification(
246+
ClientNotification::CancelledNotification(cancelled),
247+
);
247248
// `Drop` cannot await; deliver on the session's control channel without
248249
// blocking. If the channel is momentarily full the request is not
249250
// cancelled early, but the session keep-alive/idle timeout still reaps

crates/rmcp/tests/test_streamable_http_disconnect_cancel.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ struct DisconnectServer {
2929

3030
impl ServerHandler for DisconnectServer {
3131
fn get_info(&self) -> ServerInfo {
32-
ServerInfo {
33-
capabilities: ServerCapabilities::builder().enable_tools().build(),
34-
..Default::default()
35-
}
32+
ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
3633
}
3734

3835
async fn call_tool(

0 commit comments

Comments
 (0)