style(clippy): auto-fix code style issues and unnecessary map_or allocations detected by cargo clippy
This commit is contained in:
1 parent
febd48c65d
commit
706e9ad172
9 files changed
+131
-74
No files matched your search
@@ -274,10 +274,9 @@ impl McpTool for ReadPreferencesHandler {
|
||||
}
|
||||
|
||||
async fn execute(&self, _args: Value, state: Arc<MemoryState>) -> Result<String, String> {
|
||||
let data = state
|
||||
state
|
||||
.prefs
|
||||
.read_with(|prefs| serde_json::to_string(prefs).map_err(|e| e.to_string()));
|
||||
data
|
||||
.read_with(|prefs| serde_json::to_string(prefs).map_err(|e| e.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ impl McpTool for ListContextWorkspacesHandler {
|
||||
let data = state.context_workspaces.read_with(|ws| {
|
||||
let filtered: Vec<_> = ws
|
||||
.iter()
|
||||
.filter(|w| req.namespace.as_ref().map_or(true, |ns| &w.namespace == ns))
|
||||
.filter(|w| req.namespace.as_ref().is_none_or(|ns| &w.namespace == ns))
|
||||
.collect();
|
||||
serde_json::to_string(&filtered).map_err(|e| e.to_string())
|
||||
})?;
|
||||
|
||||
Reference in new issue
Block a user