From 15bf1e61d873b7f96d82531211d5d6251d4ff47b Mon Sep 17 00:00:00 2001 From: mfw78 Date: Sat, 30 May 2026 07:39:34 +0000 Subject: [PATCH] chore: apply rustfmt and silence wit-bindgen clippy lint CI runs cargo fmt --check and clippy with -D warnings. Two issues needed addressing before the first PR could go green: - Source had drifted from rustfmt output (single-call vec!, fluent builder chain on one line, etc.). Apply 'cargo fmt --all'. - modules/example: wit_bindgen::generate! expands to host-import shims whose arity matches the WIT signatures, exceeding clippy's too-many-arguments threshold. Allow the lint at crate level with a comment explaining the source. --- crates/nxm-engine/src/main.rs | 14 +++----------- modules/example/src/lib.rs | 14 +++++++++----- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/crates/nxm-engine/src/main.rs b/crates/nxm-engine/src/main.rs index 2632f43..58773d7 100644 --- a/crates/nxm-engine/src/main.rs +++ b/crates/nxm-engine/src/main.rs @@ -49,11 +49,7 @@ impl shepherd::cow::cow::Host for HostState { } impl shepherd::cow::order::Host for HostState { - async fn submit( - &mut self, - _chain_id: u64, - _order_data: Vec, - ) -> Result { + async fn submit(&mut self, _chain_id: u64, _order_data: Vec) -> Result { let start = Instant::now(); eprintln!("[order] submit"); let result = Err("not implemented".into()); @@ -242,9 +238,7 @@ async fn main() -> anyhow::Result<()> { )?; wasmtime_wasi::p2::add_to_linker_async(&mut linker)?; - let wasi = WasiCtxBuilder::new() - .inherit_stdio() - .build(); + let wasi = WasiCtxBuilder::new().inherit_stdio().build(); let mut store = Store::new( &engine, @@ -262,9 +256,7 @@ async fn main() -> anyhow::Result<()> { // Call init with config println!("nxm-engine: calling init..."); - let config_entries: Config = vec![ - ("name".into(), "example".into()), - ]; + let config_entries: Config = vec![("name".into(), "example".into())]; let start = Instant::now(); match bindings.call_init(&mut store, &config_entries).await? { Ok(()) => println!("nxm-engine: init succeeded"), diff --git a/modules/example/src/lib.rs b/modules/example/src/lib.rs index 0c0c0c0..80b18a1 100644 --- a/modules/example/src/lib.rs +++ b/modules/example/src/lib.rs @@ -1,3 +1,7 @@ +// wit_bindgen::generate! expands to host-import shims whose arity matches +// the WIT signatures, which can exceed clippy's too-many-arguments threshold. +#![allow(clippy::too_many_arguments)] + wit_bindgen::generate!({ path: "../../wit/web3-runtime", world: "headless-module", @@ -15,7 +19,10 @@ impl Guest for ExampleModule { .find(|(k, _)| k == "name") .map(|(_, v)| v.as_str()) .unwrap_or("unknown"); - logging::log(logging::Level::Info, &format!("example module init (name={name})")); + logging::log( + logging::Level::Info, + &format!("example module init (name={name})"), + ); Ok(()) } @@ -37,10 +44,7 @@ impl Guest for ExampleModule { ); } types::Event::Timer(ts) => { - logging::log( - logging::Level::Info, - &format!("timer fired at {ts}"), - ); + logging::log(logging::Level::Info, &format!("timer fired at {ts}")); } types::Event::Message(msg) => { logging::log(