Build fix for latest Rust

It seems something changed about macros and now the inner function's wf! macro tries to capture the outer function's variables. Changed the write format macro to a closure instead and removed a few redundant arguments.

Also crate_id was removed, crate_name is used now.