@@ -114,9 +114,12 @@ pub fn generate_schema(
114114 let config_ref = config_json. as_deref ( ) ;
115115 let result = generate_schema_inner ( schema_stub, tools_json, config_ref) ;
116116 drop ( config_json) ; // Explicitly consume to satisfy clippy
117- // serde_json::to_string should not fail for our result type
117+ // serde_json::to_string should not fail for our result type
118118 serde_json:: to_string ( & result) . unwrap_or_else ( |e| {
119- format ! ( r#"{{"isOk":false,"error":"Serialization error: {}","schema":null,"schemaJson":null}}"# , e)
119+ format ! (
120+ r#"{{"isOk":false,"error":"Serialization error: {}","schema":null,"schemaJson":null}}"# ,
121+ e
122+ )
120123 } )
121124}
122125
@@ -127,19 +130,17 @@ fn generate_schema_inner(
127130) -> WasmSchemaResult {
128131 // Parse config
129132 let config: SchemaGeneratorConfig = match config_json {
130- Some ( json) if !json. is_empty ( ) => {
131- match serde_json:: from_str :: < WasmConfig > ( json) {
132- Ok ( c) => c. into ( ) ,
133- Err ( e) => {
134- return WasmSchemaResult {
135- schema : None ,
136- schema_json : None ,
137- error : Some ( format ! ( "Invalid config: {e}" ) ) ,
138- is_ok : false ,
139- } ;
140- }
133+ Some ( json) if !json. is_empty ( ) => match serde_json:: from_str :: < WasmConfig > ( json) {
134+ Ok ( c) => c. into ( ) ,
135+ Err ( e) => {
136+ return WasmSchemaResult {
137+ schema : None ,
138+ schema_json : None ,
139+ error : Some ( format ! ( "Invalid config: {e}" ) ) ,
140+ is_ok : false ,
141+ } ;
141142 }
142- }
143+ } ,
143144 _ => SchemaGeneratorConfig :: default ( ) ,
144145 } ;
145146
@@ -257,7 +258,11 @@ mod tests {
257258 let result: WasmSchemaResult =
258259 serde_json:: from_str ( & result_json) . expect ( "Should parse result" ) ;
259260
260- assert ! ( result. is_ok, "Expected success, got error: {:?}" , result. error) ;
261+ assert ! (
262+ result. is_ok,
263+ "Expected success, got error: {:?}" ,
264+ result. error
265+ ) ;
261266 let schema = result. schema . expect ( "Schema should be present" ) ;
262267 assert ! (
263268 schema. contains( "read_file" ) ,
0 commit comments