Skip to content

Commit 447943b

Browse files
committed
test: add untagged ServerResult deserialization regression tests
1 parent 8f0be99 commit 447943b

33 files changed

+298
-264
lines changed

crates/rmcp/src/handler/server/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ where
138138
}
139139
}
140140

141-
#[allow(clippy::exhaustive_structs)]
141+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
142142
pub struct Extension<T>(pub T);
143143

144144
impl<C, T> FromContextPart<C> for Extension<T>
@@ -183,7 +183,7 @@ where
183183
}
184184
}
185185

186-
#[allow(clippy::exhaustive_structs)]
186+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
187187
pub struct RequestId(pub crate::model::RequestId);
188188

189189
impl<C> FromContextPart<C> for RequestId

crates/rmcp/src/handler/server/prompt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ where
153153
}
154154

155155
// Prompt-specific extractor for prompt name
156-
#[allow(clippy::exhaustive_structs)]
156+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
157157
pub struct PromptName(pub String);
158158

159159
impl<S> FromContextPart<PromptContext<'_, S>> for PromptName {

crates/rmcp/src/handler/server/router/prompt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ where
9191
}
9292

9393
/// Adapter for functions generated by the #\[prompt\] macro
94-
#[allow(clippy::exhaustive_structs)]
94+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
9595
pub struct PromptAttrGenerateFunctionAdapter;
9696

9797
impl<S, F> IntoPromptRoute<S, PromptAttrGenerateFunctionAdapter> for F

crates/rmcp/src/handler/server/router/tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ where
217217
}
218218
}
219219

220-
#[allow(clippy::exhaustive_structs)]
220+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
221221
pub struct ToolAttrGenerateFunctionAdapter;
222222
impl<S, F> IntoToolRoute<S, ToolAttrGenerateFunctionAdapter> for F
223223
where

crates/rmcp/src/handler/server/tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub type DynCallToolHandler<S> =
165165
-> futures::future::LocalBoxFuture<'s, Result<CallToolResult, crate::ErrorData>>;
166166

167167
// Tool-specific extractor for tool name
168-
#[allow(clippy::exhaustive_structs)]
168+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
169169
pub struct ToolName(pub Cow<'static, str>);
170170

171171
impl<S> FromContextPart<ToolCallContext<'_, S>> for ToolName {

crates/rmcp/src/handler/server/wrapper/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
/// serialized as structured JSON content with an associated schema.
1515
/// The framework will place the JSON in the `structured_content` field
1616
/// of the tool result rather than the regular `content` field.
17-
#[allow(clippy::exhaustive_structs)]
17+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
1818
pub struct Json<T>(pub T);
1919

2020
// Implement JsonSchema for Json<T> to delegate to T's schema

crates/rmcp/src/handler/server/wrapper/parameters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use schemars::JsonSchema;
4242
/// - Returns appropriate error responses if deserialization fails
4343
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
4444
#[serde(transparent)]
45-
#[allow(clippy::exhaustive_structs)]
45+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
4646
pub struct Parameters<P>(pub P);
4747

4848
impl<P: JsonSchema> JsonSchema for Parameters<P> {

crates/rmcp/src/model.rs

Lines changed: 41 additions & 41 deletions
Large diffs are not rendered by default.

crates/rmcp/src/model/annotated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl Annotations {
3939

4040
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4141
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
42-
#[allow(clippy::exhaustive_structs)]
42+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
4343
pub struct Annotated<T: AnnotateAble> {
4444
#[serde(flatten)]
4545
pub raw: T,

crates/rmcp/src/model/capabilities.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub type ExtensionCapabilities = BTreeMap<String, JsonObject>;
3434
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
3535
#[serde(rename_all = "camelCase")]
3636
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
37-
#[allow(clippy::exhaustive_structs)]
37+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
3838
pub struct PromptsCapability {
3939
#[serde(skip_serializing_if = "Option::is_none")]
4040
pub list_changed: Option<bool>,
@@ -43,7 +43,7 @@ pub struct PromptsCapability {
4343
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
4444
#[serde(rename_all = "camelCase")]
4545
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
46-
#[allow(clippy::exhaustive_structs)]
46+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
4747
pub struct ResourcesCapability {
4848
#[serde(skip_serializing_if = "Option::is_none")]
4949
pub subscribe: Option<bool>,
@@ -54,7 +54,7 @@ pub struct ResourcesCapability {
5454
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
5555
#[serde(rename_all = "camelCase")]
5656
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
57-
#[allow(clippy::exhaustive_structs)]
57+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
5858
pub struct ToolsCapability {
5959
#[serde(skip_serializing_if = "Option::is_none")]
6060
pub list_changed: Option<bool>,
@@ -63,7 +63,7 @@ pub struct ToolsCapability {
6363
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
6464
#[serde(rename_all = "camelCase")]
6565
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
66-
#[allow(clippy::exhaustive_structs)]
66+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
6767
pub struct RootsCapabilities {
6868
#[serde(skip_serializing_if = "Option::is_none")]
6969
pub list_changed: Option<bool>,
@@ -73,7 +73,7 @@ pub struct RootsCapabilities {
7373
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
7474
#[serde(rename_all = "camelCase")]
7575
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
76-
#[allow(clippy::exhaustive_structs)]
76+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
7777
pub struct TasksCapability {
7878
#[serde(skip_serializing_if = "Option::is_none")]
7979
pub requests: Option<TaskRequestsCapability>,
@@ -87,7 +87,7 @@ pub struct TasksCapability {
8787
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
8888
#[serde(rename_all = "camelCase")]
8989
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
90-
#[allow(clippy::exhaustive_structs)]
90+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
9191
pub struct TaskRequestsCapability {
9292
#[serde(skip_serializing_if = "Option::is_none")]
9393
pub sampling: Option<SamplingTaskCapability>,
@@ -100,7 +100,7 @@ pub struct TaskRequestsCapability {
100100
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
101101
#[serde(rename_all = "camelCase")]
102102
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
103-
#[allow(clippy::exhaustive_structs)]
103+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
104104
pub struct SamplingTaskCapability {
105105
#[serde(skip_serializing_if = "Option::is_none")]
106106
pub create_message: Option<JsonObject>,
@@ -109,7 +109,7 @@ pub struct SamplingTaskCapability {
109109
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
110110
#[serde(rename_all = "camelCase")]
111111
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
112-
#[allow(clippy::exhaustive_structs)]
112+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
113113
pub struct ElicitationTaskCapability {
114114
#[serde(skip_serializing_if = "Option::is_none")]
115115
pub create: Option<JsonObject>,
@@ -118,7 +118,7 @@ pub struct ElicitationTaskCapability {
118118
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
119119
#[serde(rename_all = "camelCase")]
120120
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
121-
#[allow(clippy::exhaustive_structs)]
121+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
122122
pub struct ToolsTaskCapability {
123123
#[serde(skip_serializing_if = "Option::is_none")]
124124
pub call: Option<JsonObject>,
@@ -199,7 +199,7 @@ impl TasksCapability {
199199
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
200200
#[serde(rename_all = "camelCase")]
201201
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
202-
#[allow(clippy::exhaustive_structs)]
202+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
203203
pub struct FormElicitationCapability {
204204
/// Whether the client supports JSON Schema validation for elicitation responses.
205205
/// When true, the client will validate user input against the requested_schema
@@ -211,7 +211,7 @@ pub struct FormElicitationCapability {
211211
/// Capability for URL mode elicitation.
212212
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
213213
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
214-
#[allow(clippy::exhaustive_structs)]
214+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
215215
pub struct UrlElicitationCapability {}
216216

217217
/// Elicitation allows servers to request interactive input from users during tool execution.
@@ -220,7 +220,7 @@ pub struct UrlElicitationCapability {}
220220
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
221221
#[serde(rename_all = "camelCase")]
222222
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
223-
#[allow(clippy::exhaustive_structs)]
223+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
224224
pub struct ElicitationCapability {
225225
/// Whether client supports form-based elicitation.
226226
#[serde(skip_serializing_if = "Option::is_none")]
@@ -234,7 +234,7 @@ pub struct ElicitationCapability {
234234
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
235235
#[serde(rename_all = "camelCase")]
236236
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
237-
#[allow(clippy::exhaustive_structs)]
237+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
238238
pub struct SamplingCapability {
239239
/// Support for `tools` and `toolChoice` parameters
240240
#[serde(skip_serializing_if = "Option::is_none")]
@@ -323,12 +323,12 @@ macro_rules! builder {
323323
($Target: ident {$($f: ident: $T: ty),* $(,)?}) => {
324324
paste! {
325325
#[derive(Default, Clone, Copy, Debug)]
326-
#[allow(clippy::exhaustive_structs)]
326+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
327327
pub struct [<$Target BuilderState>]<
328328
$(const [<$f:upper>]: bool = false,)*
329329
>;
330330
#[derive(Debug, Default)]
331-
#[allow(clippy::exhaustive_structs)]
331+
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
332332
pub struct [<$Target Builder>]<S = [<$Target BuilderState>]> {
333333
$(pub $f: Option<$T>,)*
334334
pub state: PhantomData<S>

0 commit comments

Comments
 (0)