Skip to content

Commit b0c3309

Browse files
committed
style: apply nightly rustfmt formatting to clippy fixes
Format code after clippy auto-fixes to match nightly rustfmt style. Changes: - Fix let-chain formatting in 4 files - Align opening braces for if-let chains All 352 tests passing.
1 parent e5f219b commit b0c3309

File tree

4 files changed

+44
-39
lines changed

4 files changed

+44
-39
lines changed

crates/mcp-codegen/src/common/typescript.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -204,29 +204,30 @@ pub fn extract_properties(schema: &Value) -> Vec<serde_json::Value> {
204204
let mut properties = Vec::new();
205205

206206
if let Some(obj) = schema.as_object()
207-
&& let Some(props) = obj.get("properties").and_then(|v| v.as_object()) {
208-
let required = obj
209-
.get("required")
210-
.and_then(|v| v.as_array())
211-
.map(|arr| {
212-
arr.iter()
213-
.filter_map(|v| v.as_str())
214-
.map(String::from)
215-
.collect::<Vec<_>>()
216-
})
217-
.unwrap_or_default();
207+
&& let Some(props) = obj.get("properties").and_then(|v| v.as_object())
208+
{
209+
let required = obj
210+
.get("required")
211+
.and_then(|v| v.as_array())
212+
.map(|arr| {
213+
arr.iter()
214+
.filter_map(|v| v.as_str())
215+
.map(String::from)
216+
.collect::<Vec<_>>()
217+
})
218+
.unwrap_or_default();
218219

219-
for (name, prop_schema) in props {
220-
let ts_type = json_schema_to_typescript(prop_schema);
221-
let is_required = required.contains(name);
220+
for (name, prop_schema) in props {
221+
let ts_type = json_schema_to_typescript(prop_schema);
222+
let is_required = required.contains(name);
222223

223-
properties.push(serde_json::json!({
224-
"name": name,
225-
"type": ts_type,
226-
"required": is_required,
227-
}));
228-
}
224+
properties.push(serde_json::json!({
225+
"name": name,
226+
"type": ts_type,
227+
"required": is_required,
228+
}));
229229
}
230+
}
230231

231232
properties
232233
}

crates/mcp-examples/src/mock_server.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,19 @@ impl MockMcpServer {
318318
// Basic parameter validation
319319
if let Some(obj) = params.as_object()
320320
&& let Some(schema) = tool.input_schema.as_object()
321-
&& let Some(required) = schema.get("required").and_then(|r| r.as_array()) {
322-
for req_field in required {
323-
if let Some(field_name) = req_field.as_str()
324-
&& !obj.contains_key(field_name) {
325-
return Err(MockServerError::InvalidParameters(format!(
326-
"missing required field: {}",
327-
field_name
328-
)));
329-
}
330-
}
321+
&& let Some(required) = schema.get("required").and_then(|r| r.as_array())
322+
{
323+
for req_field in required {
324+
if let Some(field_name) = req_field.as_str()
325+
&& !obj.contains_key(field_name)
326+
{
327+
return Err(MockServerError::InvalidParameters(format!(
328+
"missing required field: {}",
329+
field_name
330+
)));
331331
}
332+
}
333+
}
332334

333335
// Return configured response or default
334336
Ok(self

crates/mcp-vfs/src/vfs.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,10 @@ impl Vfs {
196196
// This is a subdirectory, add the directory path
197197
let subdir = format!("{}{}", normalized_dir, &relative[..idx]);
198198
if let Ok(subdir_path) = VfsPath::new(subdir)
199-
&& !children.contains(&subdir_path) {
200-
children.push(subdir_path);
201-
}
199+
&& !children.contains(&subdir_path)
200+
{
201+
children.push(subdir_path);
202+
}
202203
}
203204
}
204205
}

crates/mcp-wasm-runtime/src/host_functions.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ impl HostContext {
9898
*count += 1;
9999

100100
if let Some(max) = self.max_calls
101-
&& *count > max {
102-
return Err(Error::ExecutionError {
103-
message: format!("Host function call limit exceeded: {}/{}", *count, max),
104-
source: None,
105-
});
106-
}
101+
&& *count > max
102+
{
103+
return Err(Error::ExecutionError {
104+
message: format!("Host function call limit exceeded: {}/{}", *count, max),
105+
source: None,
106+
});
107+
}
107108

108109
Ok(())
109110
}

0 commit comments

Comments
 (0)