fix: resolve clippy warnings across workspace (#1195)

* fix: resolve clippy warnings across workspace

* ci: also run clippy on rmcp with all features except local

--all-features enables the local feature, which cfg-gates out
tower.rs and most of the test suite, so the existing clippy step
never actually lints them.
This commit is contained in:
Dale Seo 2026-09-08 19:05:29 -04:00 • committed by GitHub
commit 6fa40536de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 277 additions and 289 deletions

View file

@ -100,10 +100,10 @@ impl ProgressAwareClient {
}
fn stop_tracking(&self) {
if let Ok(mut tracker_opt) = self.tracker.lock() {
if let Some(tracker) = tracker_opt.take() {
tracker.print_summary();
}
if let Ok(mut tracker_opt) = self.tracker.lock()
&& let Some(tracker) = tracker_opt.take()
{
tracker.print_summary();
}
}
}
@ -114,10 +114,10 @@ impl ClientHandler for ProgressAwareClient {
params: ProgressNotificationParam,
_context: NotificationContext<RoleClient>,
) {
if let Ok(tracker_opt) = self.tracker.lock() {
if let Some(tracker) = tracker_opt.as_ref() {
tracker.handle_progress(&params);
}
if let Ok(tracker_opt) = self.tracker.lock()
&& let Some(tracker) = tracker_opt.as_ref()
{
tracker.handle_progress(&params);
}
}
@ -182,10 +182,10 @@ async fn test_stdio_transport(records: u32) -> Result<()> {
.call_tool(CallToolRequestParams::new("stream_processor"))
.await?;
if let Some(content) = tool_result.content.first() {
if let Some(text) = content.as_text() {
tracing::info!("Processing completed: {}", text.text);
}
if let Some(content) = tool_result.content.first()
&& let Some(text) = content.as_text()
{
tracing::info!("Processing completed: {}", text.text);
}
service.cancel().await?;
@ -236,10 +236,10 @@ async fn test_http_transport(http_url: &str, records: u32) -> Result<()> {
.call_tool(CallToolRequestParams::new("stream_processor"))
.await?;
if let Some(content) = tool_result.content.first() {
if let Some(text) = content.as_text() {
tracing::info!("processing completed: {}", text.text);
}
if let Some(content) = tool_result.content.first()
&& let Some(text) = content.as_text()
{
tracing::info!("processing completed: {}", text.text);
}
client.cancel().await?;

View file

@ -1,3 +1,8 @@
#![expect(
deprecated,
reason = "This example demonstrates the deprecated MCP sampling API"
)]
use anyhow::Result;
use rmcp::{
ClientHandler, ServiceExt,