Skip to content

Commit 9149a73

Browse files
committed
clippy
1 parent 7675244 commit 9149a73

24 files changed

+55
-54
lines changed

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.89.0"
2+
channel = "1.88.0"
33
components = ["rustfmt", "clippy"]

src/cli.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use clap::{arg, command, Parser};
1+
use clap::{Parser, arg, command};
22

33
#[derive(Parser, Debug)]
44
#[command(name = env!("CARGO_PKG_NAME"))]
@@ -30,9 +30,10 @@ pub struct CommandArguments {
3030
impl CommandArguments {
3131
pub fn validate(&self) -> Result<(), String> {
3232
if !self.enable_roots && self.allowed_directories.is_empty() {
33-
return Err(
34-
format!(" <ALLOWED_DIRECTORIES> is required when `--enable-roots` is not provided.\n Run `{} --help` to view the usage instructions.",env!("CARGO_PKG_NAME"))
35-
);
33+
return Err(format!(
34+
" <ALLOWED_DIRECTORIES> is required when `--enable-roots` is not provided.\n Run `{} --help` to view the usage instructions.",
35+
env!("CARGO_PKG_NAME")
36+
));
3637
}
3738
Ok(())
3839
}

src/error.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use async_zip::error::ZipError;
22
use glob::PatternError;
3-
use rust_mcp_sdk::schema::{schema_utils::SdkError, RpcError};
4-
use rust_mcp_sdk::{error::McpSdkError, TransportError};
3+
use rust_mcp_sdk::schema::{RpcError, schema_utils::SdkError};
4+
use rust_mcp_sdk::{TransportError, error::McpSdkError};
55

66
use thiserror::Error;
77
use tokio::io;
@@ -10,7 +10,9 @@ pub type ServiceResult<T> = core::result::Result<T, ServiceError>;
1010

1111
#[derive(Debug, Error)]
1212
pub enum ServiceError {
13-
#[error("Service is running in read-only mode. To enable write access, please run with the --allow-write flag.")]
13+
#[error(
14+
"Service is running in read-only mode. To enable write access, please run with the --allow-write flag."
15+
)]
1416
NoWriteAccess,
1517
#[error("{0}")]
1618
FromString(String),

src/fs_service.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ use glob::Pattern;
1010
use grep::{
1111
matcher::{Match, Matcher},
1212
regex::RegexMatcherBuilder,
13-
searcher::{sinks::UTF8, BinaryDetection, Searcher},
13+
searcher::{BinaryDetection, Searcher, sinks::UTF8},
1414
};
1515
use rust_mcp_sdk::schema::RpcError;
16-
use serde_json::{json, Value};
16+
use serde_json::{Value, json};
1717
use similar::TextDiff;
1818
use std::{
1919
collections::HashSet,
@@ -568,14 +568,12 @@ impl FileSystemService {
568568
if root_path == entry.path() {
569569
return false;
570570
}
571-
572-
let is_match = glob_pattern
571+
glob_pattern
573572
.as_ref()
574573
.map(|glob| {
575574
glob.matches(&entry.file_name().to_str().unwrap_or("").to_lowercase())
576575
})
577-
.unwrap_or(false);
578-
is_match
576+
.unwrap_or(false)
579577
});
580578

581579
Ok(result)

src/fs_service/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{
44
time::SystemTime,
55
};
66

7-
use async_zip::{error::ZipError, tokio::write::ZipFileWriter, Compression, ZipEntryBuilder};
7+
use async_zip::{Compression, ZipEntryBuilder, error::ZipError, tokio::write::ZipFileWriter};
88
use chrono::{DateTime, Local};
99
use dirs::home_dir;
1010

src/handler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ impl FileSystemHandler {
100100
vec![]
101101
} else {
102102
let roots: Vec<_> = roots.iter().map(|v| v.uri.as_str()).collect();
103-
let valid_roots = match fs_service.valid_roots(roots) {
103+
104+
match fs_service.valid_roots(roots) {
104105
Ok((roots, skipped)) => {
105106
if let Some(message) = skipped {
106107
let _ = runtime.stderr_message(message.to_string()).await;
107108
}
108109
roots
109110
}
110111
Err(_err) => vec![],
111-
};
112-
valid_roots
112+
}
113113
};
114114

115115
if valid_roots.is_empty() && !mcp_roots_support {

src/server.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use rust_mcp_sdk::schema::{
2-
Implementation, InitializeResult, ServerCapabilities, ServerCapabilitiesTools,
3-
LATEST_PROTOCOL_VERSION,
2+
Implementation, InitializeResult, LATEST_PROTOCOL_VERSION, ServerCapabilities,
3+
ServerCapabilitiesTools,
44
};
5-
use rust_mcp_sdk::{mcp_server::server_runtime, McpServer, StdioTransport, TransportOptions};
5+
use rust_mcp_sdk::{McpServer, StdioTransport, TransportOptions, mcp_server::server_runtime};
66

77
use crate::handler::FileSystemHandler;
88
use crate::{cli::CommandArguments, error::ServiceResult};

src/tools/create_directory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::path::Path;
22

3-
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
3+
use rust_mcp_sdk::macros::{JsonSchema, mcp_tool};
44
use rust_mcp_sdk::schema::TextContent;
5-
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
5+
use rust_mcp_sdk::schema::{CallToolResult, schema_utils::CallToolError};
66

77
use crate::fs_service::FileSystemService;
88

src/tools/directory_tree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
1+
use rust_mcp_sdk::macros::{JsonSchema, mcp_tool};
22
use rust_mcp_sdk::schema::TextContent;
3-
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
4-
use serde_json::{json, Map, Value};
3+
use rust_mcp_sdk::schema::{CallToolResult, schema_utils::CallToolError};
4+
use serde_json::{Map, Value, json};
55

66
use crate::error::ServiceError;
77
use crate::fs_service::FileSystemService;

src/tools/edit_file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::path::Path;
22

3-
use rust_mcp_sdk::macros::{mcp_tool, JsonSchema};
3+
use rust_mcp_sdk::macros::{JsonSchema, mcp_tool};
44
use rust_mcp_sdk::schema::TextContent;
5-
use rust_mcp_sdk::schema::{schema_utils::CallToolError, CallToolResult};
5+
use rust_mcp_sdk::schema::{CallToolResult, schema_utils::CallToolError};
66

77
use crate::fs_service::FileSystemService;
88

0 commit comments

Comments
 (0)