Skip to content

Commit aba85c0

Browse files
author
Brandon Bennett
committed
fix: clippy warnings and formatting
1 parent 3acacd3 commit aba85c0

7 files changed

Lines changed: 29 additions & 33 deletions

File tree

crates/rmcp-macros/src/skill.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl ResolvedSkillAttribute {
4545
description,
4646
dynamic,
4747
} = self;
48-
let description = if let Some(description) = description {
48+
let _description = if let Some(description) = description {
4949
quote! { Some(#description.into()) }
5050
} else {
5151
quote! { None }
@@ -149,13 +149,13 @@ pub fn skill(attr: TokenStream, input: TokenStream) -> syn::Result<TokenStream>
149149
let omit_send = cfg!(feature = "local") || attribute.local;
150150
let new_output = syn::parse2::<ReturnType>({
151151
let mut lt = quote! { 'static };
152-
if let Some(receiver) = fn_item.sig.receiver() {
153-
if let syn::ReceiverKind::Reference(_, receiver_lt, _) = &receiver.kind {
154-
if let Some(receiver_lt) = receiver_lt {
155-
lt = quote! { #receiver_lt };
156-
} else {
157-
lt = quote! { '_ };
158-
}
152+
if let Some(receiver) = fn_item.sig.receiver()
153+
&& let syn::ReceiverKind::Reference(_, receiver_lt, _) = &receiver.kind
154+
{
155+
if let Some(receiver_lt) = receiver_lt {
156+
lt = quote! { #receiver_lt };
157+
} else {
158+
lt = quote! { '_ };
159159
}
160160
}
161161
match &fn_item.sig.output {

crates/rmcp-macros/src/skill_handler.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use darling::{FromMeta, ast::NestedMeta};
22
use proc_macro2::TokenStream;
3-
use quote::{ToTokens, format_ident, quote};
4-
use syn::{Expr, ImplItem, ItemImpl, parse_quote};
3+
use quote::{ToTokens, quote};
4+
use syn::{Expr, ImplItem, ItemImpl};
55

66
use crate::common::{has_method, has_sibling_handler};
77

@@ -82,7 +82,7 @@ pub fn skill_handler(attr: TokenStream, input: TokenStream) -> syn::Result<Token
8282
let attr_args = NestedMeta::parse_meta_list(attr)?;
8383
let SkillHandlerAttribute {
8484
router,
85-
meta,
85+
meta: _,
8686
name,
8787
version,
8888
instructions,
@@ -186,17 +186,15 @@ pub fn skill_handler(attr: TokenStream, input: TokenStream) -> syn::Result<Token
186186
item_impl.items.push(directory_read_fn);
187187
}
188188

189-
if !has_method("get_info", &item_impl) {
190-
if !has_sibling_handler(&item_impl, "tool_handler") {
191-
let get_info_fn = build_get_info(
192-
&item_impl,
193-
name,
194-
version,
195-
instructions,
196-
CallerCapability::Skills,
197-
)?;
198-
item_impl.items.push(get_info_fn);
199-
}
189+
if !has_method("get_info", &item_impl) && !has_sibling_handler(&item_impl, "tool_handler") {
190+
let get_info_fn = build_get_info(
191+
&item_impl,
192+
name,
193+
version,
194+
instructions,
195+
CallerCapability::Skills,
196+
)?;
197+
item_impl.items.push(get_info_fn);
200198
}
201199

202200
Ok(item_impl.into_token_stream())

crates/rmcp/examples/skill_fs_server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ impl FileSystemSkillServer {
5252
let path = entry.path();
5353
if path.is_dir() {
5454
Self::walk_dir(root, &path, skills)?;
55-
} else if path.file_name().and_then(|s| s.to_str()) == Some(SKILL_FILE) {
56-
if let Some(skill) = Self::parse_skill_file(root, &path) {
57-
skills.insert(skill.uri.clone(), skill);
58-
}
55+
} else if path.file_name().and_then(|s| s.to_str()) == Some(SKILL_FILE)
56+
&& let Some(skill) = Self::parse_skill_file(root, &path)
57+
{
58+
skills.insert(skill.uri.clone(), skill);
5959
}
6060
}
6161
Ok(())

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ where
163163
Ok(ServerResult::SkillsListResult(
164164
crate::model::skills::SkillsListResult {
165165
result_type: Some(crate::model::ResultType::COMPLETE),
166-
skills: skills.into_iter().map(|s| s.into()).collect(),
166+
skills: skills.into_iter().collect(),
167167
next_cursor: None,
168168
ttl_ms: None,
169169
cache_scope: None,
@@ -187,7 +187,7 @@ where
187187
.await
188188
}
189189
}
190-
ClientRequest::ResourcesDirectoryReadRequest(request) => {
190+
ClientRequest::ResourcesDirectoryReadRequest(_request) => {
191191
let result = crate::model::skills::ResourcesDirectoryReadResult {
192192
result_type: Some(crate::model::ResultType::COMPLETE),
193193
children: vec![],

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use std::{borrow::Cow, sync::Arc};
1010

1111
use crate::{
1212
handler::server::skill::{CallSkillHandler, DynCallSkillHandler, SkillCallContext},
13-
model::skills::{SkillEntry, SkillResources},
14-
service::{MaybeBoxFuture, MaybeSend},
13+
model::skills::SkillEntry,
14+
service::MaybeSend,
1515
};
1616

1717
#[non_exhaustive]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
use crate::{
99
model::skills::SkillEntry,
10-
service::{MaybeBoxFuture, MaybeSend, RequestContext, RoleServer},
10+
service::{MaybeBoxFuture, RequestContext, RoleServer},
1111
};
1212

1313
/// Context passed to a skill handler when invoked.

crates/rmcp/tests/test_skills_conformance.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ use std::{
1515
process::{Command, Stdio},
1616
};
1717

18-
use rmcp::model::skills::{self, SkillResources};
19-
2018
fn skills_dir() -> std::path::PathBuf {
2119
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_string());
2220
let crate_root = std::path::PathBuf::from(manifest_dir);

0 commit comments

Comments
 (0)