Skip to content

Commit 6d411ae

Browse files
committed
chore: enable exhaustive_structs/enums clippy lints
1 parent be5c7a1 commit 6d411ae

31 files changed

Lines changed: 216 additions & 42 deletions

conformance/src/bin/client.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,8 @@ async fn perform_oauth_flow_preregistered(
252252
manager.set_metadata(metadata);
253253

254254
// Configure with pre-registered credentials
255-
let config = rmcp::transport::auth::OAuthClientConfig {
256-
client_id: client_id.to_string(),
257-
client_secret: Some(client_secret.to_string()),
258-
scopes: vec![],
259-
redirect_uri: REDIRECT_URI.to_string(),
260-
};
255+
let config = rmcp::transport::auth::OAuthClientConfig::new(client_id, REDIRECT_URI)
256+
.with_client_secret(client_secret);
261257
manager.configure_client(config)?;
262258

263259
let scopes = manager.select_scopes(None, &[]);

conformance/src/bin/server.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,10 +818,7 @@ async fn main() -> anyhow::Result<()> {
818818
tracing::info!("Starting conformance server on {}", bind_addr);
819819

820820
let server = ConformanceServer::new();
821-
let config = StreamableHttpServerConfig {
822-
stateful_mode: true,
823-
..Default::default()
824-
};
821+
let config = StreamableHttpServerConfig::default();
825822
let service = StreamableHttpService::new(
826823
move || Ok(server.clone()),
827824
LocalSessionManager::default().into(),

crates/rmcp/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ readme = { workspace = true }
99
description = "Rust SDK for Model Context Protocol"
1010
documentation = "https://docs.rs/rmcp"
1111

12+
[lints.clippy]
13+
exhaustive_structs = "warn"
14+
exhaustive_enums = "warn"
15+
1216
[package.metadata.docs.rs]
1317
all-features = true
1418
rustdoc-args = ["--cfg", "docsrs"]

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

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

141+
#[allow(clippy::exhaustive_structs)]
141142
pub struct Extension<T>(pub T);
142143

143144
impl<C, T> FromContextPart<C> for Extension<T>
@@ -182,6 +183,7 @@ where
182183
}
183184
}
184185

186+
#[allow(clippy::exhaustive_structs)]
185187
pub struct RequestId(pub crate::model::RequestId);
186188

187189
impl<C> FromContextPart<C> for RequestId

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

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

155155
// Prompt-specific extractor for prompt name
156+
#[allow(clippy::exhaustive_structs)]
156157
pub struct PromptName(pub String);
157158

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

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

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

9393
/// Adapter for functions generated by the #\[prompt\] macro
94+
#[allow(clippy::exhaustive_structs)]
9495
pub struct PromptAttrGenerateFunctionAdapter;
9596

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

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

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

220+
#[allow(clippy::exhaustive_structs)]
220221
pub struct ToolAttrGenerateFunctionAdapter;
221222
impl<S, F> IntoToolRoute<S, ToolAttrGenerateFunctionAdapter> for F
222223
where

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +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)]
168169
pub struct ToolName(pub Cow<'static, str>);
169170

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +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)]
1718
pub struct Json<T>(pub T);
1819

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +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)]
4546
pub struct Parameters<P>(pub P);
4647

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

0 commit comments

Comments
 (0)