Repository: bytecodealliance/wasmtime
Pull request #7601 (2023-11-29 16:58:10)

add clang format
Add a .clang-format for the C code in wasmtime.

We choose the WebKit style because out of all the style options available in .clang-format, it was the closes to the existing style of the c-api crate. I am not really interested in tuning the settings more, but more want consistency and to let the tool format instead of it happening manually.

There is also a check added in CI for it, it always runs and should be very fast. It uses the latest installed `clang-format` binary in GitHub actions, but I am also happy to download a fixed version if we want to pin the version.


alexcrichton: Thanks! Would it actually be reasonable to remove `.clang-format` and leave clang to its defaults? I'm no `clang-format` expert myself but if it's common to use the default settings I think that'd be reasonable to do here too

Patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e2dee7f9a..b4cb5cfd7 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -55,6 +55,22 @@ jobs:
       env:
         GH_TOKEN: ${{ github.token }}
 
+  # Check Code style quickly by running `clang-format` over all the C/C++ code
+  clangformat:
+    name: Clang format
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v3
+      with:
+        submodules: true
+    - run: git ls-files '*.h' '*.c' '*.cpp' | xargs clang-format-15 --dry-run --Werror --verbose
+
+    # common logic to cancel the entire run if this job fails
+    - run: gh run cancel ${{ github.run_id }}
+      if: failure() && github.event_name != 'pull_request'
+      env:
+        GH_TOKEN: ${{ github.token }}
+
   # Lint dependency graph for security advisories, duplicate versions, and
   # incompatible licences
   cargo_deny:
diff --git a/crates/c-api/include/doc-wasm.h b/crates/c-api/include/doc-wasm.h
index 6bad15c74..45afbecf9 100644
--- a/crates/c-api/include/doc-wasm.h
+++ b/crates/c-api/include/doc-wasm.h
@@ -1,3 +1,5 @@
+/* clang-format off */
+
 /**
  * \file wasm.h
  *
diff --git a/crates/c-api/include/wasi.h b/crates/c-api/include/wasi.h
index e927e04a4..1f520cb26 100644
--- a/crates/c-api/include/wasi.h
+++ b/crates/c-api/include/wasi.h
@@ -7,8 +7,8 @@
 #ifndef WASI_H
 #define WASI_H
 
-#include <stdint.h>
 #include "wasm.h"
+#include <stdint.h>
 
 #ifndef WASI_API_EXTERN
 #ifdef _WIN32
@@ -24,9 +24,9 @@ extern "C" {
 
 #define own
 
-#define WASI_DECLARE_OWN(name) \
-  typedef struct wasi_##name##_t wasi_##name##_t; \
-  WASI_API_EXTERN void wasi_##name##_delete(own wasi_##name##_t*);
+#define WASI_DECLARE_OWN(name)                                                 \
+  typedef struct wasi_##name##_t wasi_##name##_t;                              \
+  WASI_API_EXTERN void wasi_##name##_delete(own wasi_##name##_t *);
 
 /**
  * \typedef wasi_config_t
@@ -45,7 +45,7 @@ WASI_DECLARE_OWN(config)
  *
  * The caller is expected to deallocate the returned configuration
  */
-WASI_API_EXTERN own wasi_config_t* wasi_config_new();
+WASI_API_EXTERN own wasi_config_t *wasi_config_new();
 
 /**
  * \brief Sets the argv list for this configuration object.
@@ -56,13 +56,14 @@ WASI_API_EXTERN own wasi_config_t* wasi_config_new();
  * The arguments are copied into the `config` object as part of this function
  * call, so the `argv` pointer only needs to stay alive for this function call.
  */
-WASI_API_EXTERN void wasi_config_set_argv(wasi_config_t* config, int argc, const char* argv[]);
+WASI_API_EXTERN void wasi_config_set_argv(wasi_config_t *config, int argc,
+                                          const char *argv[]);
 
 /**
  * \brief Indicates that the argv list should be inherited from this process's
  * argv list.
  */
-WASI_API_EXTERN void wasi_config_inherit_argv(wasi_config_t* config);
+WASI_API_EXTERN void wasi_config_inherit_argv(wasi_config_t *config);
 
 /**
  * \brief Sets the list of environment variables available to the WASI instance.
@@ -76,13 +77,15 @@ WASI_API_EXTERN void wasi_config_inherit_argv(wasi_config_t* config);
  * call, so the `names` and `values` pointers only need to stay alive for this
  * function call.
  */
-WASI_API_EXTERN void wasi_config_set_env(wasi_config_t* config, int envc, const char* names[], const char* values[]);
+WASI_API_EXTERN void wasi_config_set_env(wasi_config_t *config, int envc,
+                                         const char *names[],
+                                         const char *values[]);
 
 /**
  * \brief Indicates that the entire environment of the calling process should be
  * inherited by this WASI configuration.
  */
-WASI_API_EXTERN void wasi_config_inherit_env(wasi_config_t* config);
+WASI_API_EXTERN void wasi_config_inherit_env(wasi_config_t *config);
 
 /**
  * \brief Configures standard input to be taken from the specified file.
@@ -93,23 +96,26 @@ WASI_API_EXTERN void wasi_config_inherit_env(wasi_config_t* config);
  * If the stdin location does not exist or it cannot be opened for reading then
  * `false` is returned. Otherwise `true` is returned.
  */
-WASI_API_EXTERN bool wasi_config_set_stdin_file(wasi_config_t* config, const char* path);
+WASI_API_EXTERN bool wasi_config_set_stdin_file(wasi_config_t *config,
+                                                const char *path);
 
 /**
- * \brief Configures standard input to be taken from the specified #wasm_byte_vec_t.
+ * \brief Configures standard input to be taken from the specified
+ * #wasm_byte_vec_t.
  *
  * By default WASI programs have no stdin, but this configures the specified
  * bytes to be used as stdin for this configuration.
  *
  * This function takes ownership of the `binary` argument.
  */
-WASI_API_EXTERN void wasi_config_set_stdin_bytes(wasi_config_t* config, wasm_byte_vec_t* binary);
+WASI_API_EXTERN void wasi_config_set_stdin_bytes(wasi_config_t *config,
+                                                 wasm_byte_vec_t *binary);
 
 /**
  * \brief Configures this process's own stdin stream to be used as stdin for
  * this WASI configuration.
  */
-WASI_API_EXTERN void wasi_config_inherit_stdin(wasi_config_t* config);
+WASI_API_EXTERN void wasi_config_inherit_stdin(wasi_config_t *config);
 
 /**
  * \brief Configures standard output to be written to the specified file.
@@ -120,13 +126,14 @@ WASI_API_EXTERN void wasi_config_inherit_stdin(wasi_config_t* config);
  * If the stdout location could not be opened for writing then `false` is
  * returned. Otherwise `true` is returned.
  */
-WASI_API_EXTERN bool wasi_config_set_stdout_file(wasi_config_t* config, const char* path);
+WASI_API_EXTERN bool wasi_config_set_stdout_file(wasi_config_t *config,
+                                                 const char *path);
 
 /**
  * \brief Configures this process's own stdout stream to be used as stdout for
  * this WASI configuration.
  */
-WASI_API_EXTERN void wasi_config_inherit_stdout(wasi_config_t* config);
+WASI_API_EXTERN void wasi_config_inherit_stdout(wasi_config_t *config);
 
 /**
  * \brief Configures standard output to be written to the specified file.
@@ -137,25 +144,29 @@ WASI_API_EXTERN void wasi_config_inherit_stdout(wasi_config_t* config);
  * If the stderr location could not be opened for writing then `false` is
  * returned. Otherwise `true` is returned.
  */
-WASI_API_EXTERN bool wasi_config_set_stderr_file(wasi_config_t* config, const char* path);
+WASI_API_EXTERN bool wasi_config_set_stderr_file(wasi_config_t *config,
+                                                 const char *path);
 
 /**
  * \brief Configures this process's own stderr stream to be used as stderr for
  * this WASI configuration.
  */
-WASI_API_EXTERN void wasi_config_inherit_stderr(wasi_config_t* config);
+WASI_API_EXTERN void wasi_config_inherit_stderr(wasi_config_t *config);
 
 /**
  * \brief Configures a "preopened directory" to be available to WASI APIs.
  *
  * By default WASI programs do not have access to anything on the filesystem.
  * This API can be used to grant WASI programs access to a directory on the
- * filesystem, but only that directory (its whole contents but nothing above it).
+ * filesystem, but only that directory (its whole contents but nothing above
+ * it).
  *
  * The `path` argument here is a path name on the host filesystem, and
  * `guest_path` is the name by which it will be known in wasm.
  */
-WASI_API_EXTERN bool wasi_config_preopen_dir(wasi_config_t* config, const char* path, const char* guest_path);
+WASI_API_EXTERN bool wasi_config_preopen_dir(wasi_config_t *config,
+                                             const char *path,
+                                             const char *guest_path);
 
 /**
  * \brief Configures a "preopened" listen socket to be available to WASI APIs.
@@ -168,12 +179,14 @@ WASI_API_EXTERN bool wasi_config_preopen_dir(wasi_config_t* config, const char*
  * known in WASM and the host_port is the IP address and port (e.g.
  * "127.0.0.1:8080") requested to listen on.
  */
-WASI_API_EXTERN bool wasi_config_preopen_socket(wasi_config_t* config, uint32_t fd_num, const char* host_port);
+WASI_API_EXTERN bool wasi_config_preopen_socket(wasi_config_t *config,
+                                                uint32_t fd_num,
+                                                const char *host_port);
 
 #undef own
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
-#endif  // #ifdef WASI_H
+#endif // #ifdef WASI_H
diff --git a/crates/c-api/include/wasmtime.h b/crates/c-api/include/wasmtime.h
index 50d5ec8d1..fb1e36f64 100644
--- a/crates/c-api/include/wasmtime.h
+++ b/crates/c-api/include/wasmtime.h
@@ -57,7 +57,8 @@
  *
  * * Linux - `-lpthread -ldl -lm`
  * * macOS - no extra flags needed
- * * Windows - `ws2_32.lib advapi32.lib userenv.lib ntdll.lib shell32.lib ole32.lib bcrypt.lib`
+ * * Windows - `ws2_32.lib advapi32.lib userenv.lib ntdll.lib shell32.lib
+ * ole32.lib bcrypt.lib`
  *
  * ## Building from Source
  *
@@ -181,6 +182,7 @@
 #define WASMTIME_API_H
 
 #include <wasi.h>
+// clang-format off
 // IWYU pragma: begin_exports
 #include <wasmtime/config.h>
 #include <wasmtime/engine.h>
@@ -198,6 +200,7 @@
 #include <wasmtime/val.h>
 #include <wasmtime/async.h>
 // IWYU pragma: end_exports
+// clang-format on
 
 /**
  * \brief Wasmtime version string.
@@ -223,11 +226,11 @@ extern "C" {
 /**
  * \brief Converts from the text format of WebAssembly to to the binary format.
  *
- * \param wat this it the input pointer with the WebAssembly Text Format inside of
- *   it. This will be parsed and converted to the binary format.
+ * \param wat this it the input pointer with the WebAssembly Text Format inside
+ *        of it. This will be parsed and converted to the binary format.
  * \param wat_len this it the length of `wat`, in bytes.
- * \param ret if the conversion is successful, this byte vector is filled in with
- *   the WebAssembly binary format.
+ * \param ret if the conversion is successful, this byte vector is filled in
+ *        with the WebAssembly binary format.
  *
  * \return a non-null error if parsing fails, or returns `NULL`. If parsing
  * fails then `ret` isn't touched.
@@ -235,14 +238,11 @@ extern "C" {
  * This function does not take ownership of `wat`, and the caller is expected to
  * deallocate the returned #wasmtime_error_t and #wasm_byte_vec_t.
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_wat2wasm(
-    const char *wat,
-    size_t wat_len,
-    wasm_byte_vec_t *ret
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_wat2wasm(const char *wat, size_t wat_len, wasm_byte_vec_t *ret);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_API_H
diff --git a/crates/c-api/include/wasmtime/async.h b/crates/c-api/include/wasmtime/async.h
index 1ff8ccef7..bb2e986f7 100644
--- a/crates/c-api/include/wasmtime/async.h
+++ b/crates/c-api/include/wasmtime/async.h
@@ -6,23 +6,27 @@
  * Async functionality in Wasmtime is well documented here:
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.async_support
  *
- * All WebAssembly executes synchronously, but an async support enables the Wasm code
- * be executed on a seperate stack, so it can be paused and resumed. There are three
- * mechanisms for yielding control from wasm to the caller: fuel, epochs, and async host functions.
- *
- * When WebAssembly is executed, a #wasmtime_call_future_t is returned. This struct represents the
- * state of the execution and each call to #wasmtime_call_future_poll will execute the WebAssembly
- * code on a seperate stack until the function returns or yields control back to the caller.
- *
- * It's expected these futures are pulled in a loop until completed, at which point the future 
- * should be deleted. Functions that return a #wasmtime_call_future_t are special in that all 
- * parameters to that function should not be modified in any way and must be kept alive until
- * the future is deleted. This includes concurrent calls for a single store - another function
- * on a store should not be called while there is a #wasmtime_call_future_t alive.
- *
- * As for asynchronous host calls - the reverse contract is upheld. Wasmtime will keep all parameters
- * to the function alive and unmodified until the #wasmtime_func_async_continuation_callback_t returns
- * true.
+ * All WebAssembly executes synchronously, but an async support enables the Wasm
+ * code be executed on a seperate stack, so it can be paused and resumed. There
+ * are three mechanisms for yielding control from wasm to the caller: fuel,
+ * epochs, and async host functions.
+ *
+ * When WebAssembly is executed, a #wasmtime_call_future_t is returned. This
+ * struct represents the state of the execution and each call to
+ * #wasmtime_call_future_poll will execute the WebAssembly code on a seperate
+ * stack until the function returns or yields control back to the caller.
+ *
+ * It's expected these futures are pulled in a loop until completed, at which
+ * point the future should be deleted. Functions that return a
+ * #wasmtime_call_future_t are special in that all parameters to that function
+ * should not be modified in any way and must be kept alive until the future is
+ * deleted. This includes concurrent calls for a single store - another function
+ * on a store should not be called while there is a #wasmtime_call_future_t
+ * alive.
+ *
+ * As for asynchronous host calls - the reverse contract is upheld. Wasmtime
+ * will keep all parameters to the function alive and unmodified until the
+ * #wasmtime_func_async_continuation_callback_t returns true.
  *
  */
 
@@ -30,22 +34,24 @@
 #define WASMTIME_ASYNC_H
 
 #include <wasm.h>
-#include <wasmtime/error.h>
 #include <wasmtime/config.h>
-#include <wasmtime/store.h>
+#include <wasmtime/error.h>
 #include <wasmtime/func.h>
 #include <wasmtime/linker.h>
+#include <wasmtime/store.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /**
- * \brief Whether or not to enable support for asynchronous functions in Wasmtime.
+ * \brief Whether or not to enable support for asynchronous functions in
+ * Wasmtime.
  *
- * When enabled, the config can optionally define host functions with async. 
- * Instances created and functions called with this Config must be called through their asynchronous APIs, however.
- * For example using wasmtime_func_call will panic when used with this config.
+ * When enabled, the config can optionally define host functions with async.
+ * Instances created and functions called with this Config must be called
+ * through their asynchronous APIs, however. For example using
+ * wasmtime_func_call will panic when used with this config.
  *
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.async_support
@@ -55,13 +61,15 @@ WASMTIME_CONFIG_PROP(void, async_support, bool)
 /**
  * \brief Configures the size of the stacks used for asynchronous execution.
  *
- * This setting configures the size of the stacks that are allocated for asynchronous execution. 
+ * This setting configures the size of the stacks that are allocated for
+ * asynchronous execution.
  *
  * The value cannot be less than max_wasm_stack.
  *
- * The amount of stack space guaranteed for host functions is async_stack_size - max_wasm_stack, so take care
- * not to set these two values close to one another; doing so may cause host functions to overflow the stack 
- * and abort the process.
+ * The amount of stack space guaranteed for host functions is async_stack_size -
+ * max_wasm_stack, so take care not to set these two values close to one
+ * another; doing so may cause host functions to overflow the stack and abort
+ * the process.
  *
  * By default this option is 2 MiB.
  *
@@ -86,27 +94,28 @@ WASMTIME_CONFIG_PROP(void, async_stack_size, uint64_t)
  * \param interval the amount of fuel at which to yield. A value of 0 will
  *        disable yielding.
  */
-WASM_API_EXTERN wasmtime_error_t*
+WASM_API_EXTERN wasmtime_error_t *
 wasmtime_context_fuel_async_yield_interval(wasmtime_context_t *context,
                                            uint64_t interval);
 
 /**
- * \brief Configures epoch-deadline expiration to yield to the async caller and the update the deadline.
+ * \brief Configures epoch-deadline expiration to yield to the async caller and
+ * the update the deadline.
  *
- * This is only suitable with use of a store associated with an async config because
- * only then are futures used and yields are possible.
+ * This is only suitable with use of a store associated with an async config
+ * because only then are futures used and yields are possible.
  *
  * See the Rust documentation for more:
  * https://docs.wasmtime.dev/api/wasmtime/struct.Store.html#method.epoch_deadline_async_yield_and_update
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_context_epoch_deadline_async_yield_and_update(
-    wasmtime_context_t *context,
-    uint64_t delta);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_context_epoch_deadline_async_yield_and_update(
+    wasmtime_context_t *context, uint64_t delta);
 
 /**
  * The callback to determine a continuation's current state.
  *
- * Return true if the host call has completed, otherwise false will 
+ * Return true if the host call has completed, otherwise false will
  * continue to yield WebAssembly execution.
  */
 typedef bool (*wasmtime_func_async_continuation_callback_t)(void *env);
@@ -126,59 +135,58 @@ typedef struct wasmtime_async_continuation_t {
 /**
  * \brief Callback signature for #wasmtime_linker_define_async_func.
  *
- * This is a host function that returns a continuation to be called later. 
+ * This is a host function that returns a continuation to be called later.
  *
  * All the arguments to this function will be kept alive until the continuation
  * returns that it has errored or has completed.
  *
- * \param env user-provided argument passed to #wasmtime_linker_define_async_func
+ * \param env user-provided argument passed to
+ *        #wasmtime_linker_define_async_func
  * \param caller a temporary object that can only be used during this function
- * call. Used to acquire #wasmtime_context_t or caller's state
+ *        call. Used to acquire #wasmtime_context_t or caller's state
  * \param args the arguments provided to this function invocation
  * \param nargs how many arguments are provided
  * \param results where to write the results of this function
  * \param nresults how many results must be produced
- * \param trap_ret if assigned a not `NULL` value then the called function will
- *        trap with the returned error. Note that ownership of trap is transferred
- *        to wasmtime.
- * \param continuation_ret the returned continuation that determines when the 
- *        async function has completed executing.
+ * \param trap_ret if assigned a not `NULL` value then the called
+ *        function will trap with the returned error. Note that ownership of
+ *        trap is transferred to wasmtime.
+ * \param continuation_ret the returned continuation
+ *        that determines when the async function has completed executing.
  *
  * Only supported for async stores.
  *
  * See #wasmtime_func_callback_t for more information.
  */
 typedef void (*wasmtime_func_async_callback_t)(
-    void *env,
-    wasmtime_caller_t *caller, 
-    const wasmtime_val_t *args,
-    size_t nargs, 
-    wasmtime_val_t *results,
-    size_t nresults,
-    wasm_trap_t** trap_ret,
-    wasmtime_async_continuation_t * continuation_ret);
+    void *env, wasmtime_caller_t *caller, const wasmtime_val_t *args,
+    size_t nargs, wasmtime_val_t *results, size_t nresults,
+    wasm_trap_t **trap_ret, wasmtime_async_continuation_t *continuation_ret);
 
 /**
  * \brief The structure representing a asynchronously running function.
  *
- * This structure is always owned by the caller and must be deleted using #wasmtime_call_future_delete.
+ * This structure is always owned by the caller and must be deleted using
+ * #wasmtime_call_future_delete.
  *
- * Functions that return this type require that the parameters to the function are unmodified until 
- * this future is destroyed.
+ * Functions that return this type require that the parameters to the function
+ * are unmodified until this future is destroyed.
  */
 typedef struct wasmtime_call_future wasmtime_call_future_t;
 
 /**
  * \brief Executes WebAssembly in the function.
  *
- * Returns true if the function call has completed. After this function returns true, it should *not* be 
- * called again for a given future.
+ * Returns true if the function call has completed. After this function returns
+ * true, it should *not* be called again for a given future.
  *
- * This function returns false if execution has yielded either due to being out of fuel 
- * (see wasmtime_context_fuel_async_yield_interval), or the epoch has been incremented enough 
- * (see wasmtime_context_epoch_deadline_async_yield_and_update). The function may also return false if 
- * asynchronous host functions have been called, which then calling this  function will call the 
- * continuation from the async host function.
+ * This function returns false if execution has yielded either due to being out
+ * of fuel (see wasmtime_context_fuel_async_yield_interval), or the epoch has
+ * been incremented enough (see
+ * wasmtime_context_epoch_deadline_async_yield_and_update). The function may
+ * also return false if asynchronous host functions have been called, which then
+ * calling this  function will call the continuation from the async host
+ * function.
  *
  * For more see the information at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#asynchronous-wasm
@@ -189,86 +197,83 @@ WASM_API_EXTERN bool wasmtime_call_future_poll(wasmtime_call_future_t *future);
 /**
  * /brief Frees the underlying memory for a future.
  *
- * All wasmtime_call_future_t are owned by the caller and should be deleted using this function.
+ * All wasmtime_call_future_t are owned by the caller and should be deleted
+ * using this function.
  */
-WASM_API_EXTERN void wasmtime_call_future_delete(wasmtime_call_future_t *future);
+WASM_API_EXTERN void
+wasmtime_call_future_delete(wasmtime_call_future_t *future);
 
 /**
- * \brief Invokes this function with the params given, returning the results asynchronously.
+ * \brief Invokes this function with the params given, returning the results
+ * asynchronously.
  *
- * This function is the same as wasmtime_func_call except that it is asynchronous.
- * This is only compatible with stores associated with an asynchronous config.
+ * This function is the same as wasmtime_func_call except that it is
+ * asynchronous. This is only compatible with stores associated with an
+ * asynchronous config.
  *
- * The result is a future that is owned by the caller and must be deleted via #wasmtime_call_future_delete. 
+ * The result is a future that is owned by the caller and must be deleted via
+ * #wasmtime_call_future_delete.
  *
- * The `args` and `results` pointers may be `NULL` if the corresponding length is zero.
- * The `trap_ret` and `error_ret` pointers may *not* be `NULL`.
+ * The `args` and `results` pointers may be `NULL` if the corresponding length
+ * is zero. The `trap_ret` and `error_ret` pointers may *not* be `NULL`.
  *
- * Does not take ownership of #wasmtime_val_t arguments or #wasmtime_val_t results,
- * and all parameters to this function must be kept alive and not modified until the
- * returned #wasmtime_call_future_t is deleted. This includes the context and store
- * parameters. Only a single future can be alive for a given store at a single time 
- * (meaning only call this function after the previous call's future was deleted).
+ * Does not take ownership of #wasmtime_val_t arguments or #wasmtime_val_t
+ * results, and all parameters to this function must be kept alive and not
+ * modified until the returned #wasmtime_call_future_t is deleted. This includes
+ * the context and store parameters. Only a single future can be alive for a
+ * given store at a single time (meaning only call this function after the
+ * previous call's future was deleted).
  *
  * See the header documentation for for more information.
  *
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Func.html#method.call_async
  */
-WASM_API_EXTERN wasmtime_call_future_t* wasmtime_func_call_async(
-    wasmtime_context_t *context,
-    const wasmtime_func_t *func,
-    const wasmtime_val_t *args,
-    size_t nargs,
-    wasmtime_val_t *results,
-    size_t nresults,
-    wasm_trap_t** trap_ret,
-    wasmtime_error_t** error_ret);
+WASM_API_EXTERN wasmtime_call_future_t *wasmtime_func_call_async(
+    wasmtime_context_t *context, const wasmtime_func_t *func,
+    const wasmtime_val_t *args, size_t nargs, wasmtime_val_t *results,
+    size_t nresults, wasm_trap_t **trap_ret, wasmtime_error_t **error_ret);
 
 /**
  * \brief Defines a new async function in this linker.
  *
- * This function behaves similar to #wasmtime_linker_define_func, except it supports async
- * callbacks.
+ * This function behaves similar to #wasmtime_linker_define_func, except it
+ * supports async callbacks.
  *
  * The callback `cb` will be invoked on another stack (fiber for Windows).
  */
 WASM_API_EXTERN wasmtime_error_t *wasmtime_linker_define_async_func(
-    wasmtime_linker_t *linker,
-    const char *module,
-    size_t module_len,
-    const char *name,
-    size_t name_len,
-    const wasm_functype_t *ty,
-    wasmtime_func_async_callback_t cb,
-    void *data,
-    void (*finalizer)(void *));
+    wasmtime_linker_t *linker, const char *module, size_t module_len,
+    const char *name, size_t name_len, const wasm_functype_t *ty,
+    wasmtime_func_async_callback_t cb, void *data, void (*finalizer)(void *));
 
 /**
- * \brief Instantiates a #wasm_module_t with the items defined in this linker for an async store.
+ * \brief Instantiates a #wasm_module_t with the items defined in this linker
+ * for an async store.
  *
- * This is the same as #wasmtime_linker_instantiate but used for async stores 
- * (which requires functions are called asynchronously). The returning #wasmtime_call_future_t 
- * must be polled using #wasmtime_call_future_poll, and is owned and must be deleted using #wasmtime_call_future_delete.
+ * This is the same as #wasmtime_linker_instantiate but used for async stores
+ * (which requires functions are called asynchronously). The returning
+ * #wasmtime_call_future_t must be polled using #wasmtime_call_future_poll, and
+ * is owned and must be deleted using #wasmtime_call_future_delete.
  *
- * The `trap_ret` and `error_ret` pointers may *not* be `NULL` and the returned memory is owned by the caller.
+ * The `trap_ret` and `error_ret` pointers may *not* be `NULL` and the returned
+ * memory is owned by the caller.
  *
- * All arguments to this function must outlive the returned future and be unmodified until the future is deleted.
+ * All arguments to this function must outlive the returned future and be
+ * unmodified until the future is deleted.
  */
 WASM_API_EXTERN wasmtime_call_future_t *wasmtime_linker_instantiate_async(
-    const wasmtime_linker_t *linker,
-    wasmtime_context_t *store,
-    const wasmtime_module_t *module,
-    wasmtime_instance_t *instance,
-    wasm_trap_t** trap_ret,
-    wasmtime_error_t** error_ret);
+    const wasmtime_linker_t *linker, wasmtime_context_t *store,
+    const wasmtime_module_t *module, wasmtime_instance_t *instance,
+    wasm_trap_t **trap_ret, wasmtime_error_t **error_ret);
 
 /**
  * \brief Instantiates instance within the given store.
  *
  * This will also run the function's startup function, if there is one.
  *
- * For more information on async instantiation see #wasmtime_linker_instantiate_async.
+ * For more information on async instantiation see
+ * #wasmtime_linker_instantiate_async.
  *
  * \param instance_pre the pre-initialized instance
  * \param store the store in which to create the instance
@@ -276,16 +281,16 @@ WASM_API_EXTERN wasmtime_call_future_t *wasmtime_linker_instantiate_async(
  * \param trap_ret where to store the returned trap
  * \param error_ret where to store the returned trap
  *
- * The `trap_ret` and `error_ret` pointers may *not* be `NULL` and the returned memory is owned by the caller.
+ * The `trap_ret` and `error_ret` pointers may *not* be `NULL` and the returned
+ * memory is owned by the caller.
  *
- * All arguments to this function must outlive the returned future and be unmodified until the future is deleted.
+ * All arguments to this function must outlive the returned future and be
+ * unmodified until the future is deleted.
  */
 WASM_API_EXTERN wasmtime_call_future_t *wasmtime_instance_pre_instantiate_async(
-    const wasmtime_instance_pre_t* instance_pre,
-    wasmtime_context_t *store,
-    wasmtime_instance_t *instance,
-    wasm_trap_t** trap_ret,
-    wasmtime_error_t** error_ret);
+    const wasmtime_instance_pre_t *instance_pre, wasmtime_context_t *store,
+    wasmtime_instance_t *instance, wasm_trap_t **trap_ret,
+    wasmtime_error_t **error_ret);
 
 /**
  * A callback to get the top of the stack address and the length of the stack,
@@ -294,9 +299,8 @@ WASM_API_EXTERN wasmtime_call_future_t *wasmtime_instance_pre_instantiate_async(
  * For more information about the parameters see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/trait.StackMemory.html
  */
-typedef uint8_t *(*wasmtime_stack_memory_get_callback_t)(
-    void *env,
-    size_t *out_len);
+typedef uint8_t *(*wasmtime_stack_memory_get_callback_t)(void *env,
+                                                         size_t *out_len);
 
 /**
  * A Stack instance created from a #wasmtime_new_stack_memory_callback_t.
@@ -310,14 +314,14 @@ typedef struct {
   /// Callback to get the memory and size of this LinearMemory
   wasmtime_stack_memory_get_callback_t get_stack_memory;
   /// An optional finalizer for env
-  void (*finalizer)(void*);
+  void (*finalizer)(void *);
 } wasmtime_stack_memory_t;
 
 /**
  * A callback to create a new StackMemory from the specified parameters.
  *
- * The result should be written to `stack_ret` and wasmtime will own the values written 
- * into that struct.
+ * The result should be written to `stack_ret` and wasmtime will own the values
+ * written into that struct.
  *
  * This callback must be thread-safe.
  *
@@ -325,9 +329,7 @@ typedef struct {
  * https://docs.wasmtime.dev/api/wasmtime/trait.StackCreator.html#tymethod.new_stack
  */
 typedef wasmtime_error_t *(*wasmtime_new_stack_memory_callback_t)(
-    void *env,
-    size_t size,
-    wasmtime_stack_memory_t *stack_ret);
+    void *env, size_t size, wasmtime_stack_memory_t *stack_ret);
 
 /**
  * A representation of custom stack creator.
@@ -337,33 +339,31 @@ typedef wasmtime_error_t *(*wasmtime_new_stack_memory_callback_t)(
  */
 typedef struct {
   /// User provided value to be passed to new_stack
-  void* env;
+  void *env;
   /// The callback to create a new stack, must be thread safe
   wasmtime_new_stack_memory_callback_t new_stack;
   /// An optional finalizer for env.
-  void (*finalizer)(void*);
+  void (*finalizer)(void *);
 } wasmtime_stack_creator_t;
 
 /**
  * Sets a custom stack creator.
  *
- * Custom memory creators are used when creating creating async instance stacks for
- * the on-demand instance allocation strategy.
+ * Custom memory creators are used when creating creating async instance stacks
+ * for the on-demand instance allocation strategy.
  *
- * The config does **not** take ownership of the #wasmtime_stack_creator_t passed in, but 
- * instead copies all the values in the struct.
+ * The config does **not** take ownership of the #wasmtime_stack_creator_t
+ * passed in, but instead copies all the values in the struct.
  *
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.with_host_stack
  */
-WASM_API_EXTERN void wasmtime_config_host_stack_creator_set(
-    wasm_config_t*,
-    wasmtime_stack_creator_t*);
-
+WASM_API_EXTERN void
+wasmtime_config_host_stack_creator_set(wasm_config_t *,
+                                       wasmtime_stack_creator_t *);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_ASYNC_H
-
diff --git a/crates/c-api/include/wasmtime/config.h b/crates/c-api/include/wasmtime/config.h
index eb17b5e25..9bd2a4e7e 100644
--- a/crates/c-api/include/wasmtime/config.h
+++ b/crates/c-api/include/wasmtime/config.h
@@ -86,8 +86,8 @@ enum wasmtime_profiling_strategy_enum { // ProfilingStrategy
   WASMTIME_PROFILING_STRATEGY_PERFMAP,
 };
 
-#define WASMTIME_CONFIG_PROP(ret, name, ty) \
-    WASM_API_EXTERN ret wasmtime_config_##name##_set(wasm_config_t*, ty);
+#define WASMTIME_CONFIG_PROP(ret, name, ty)                                    \
+  WASM_API_EXTERN ret wasmtime_config_##name##_set(wasm_config_t *, ty);
 
 /**
  * \brief Configures whether DWARF debug information is constructed at runtime
@@ -221,7 +221,8 @@ WASMTIME_CONFIG_PROP(void, wasm_memory64, bool)
 WASMTIME_CONFIG_PROP(void, strategy, wasmtime_strategy_t)
 
 /**
- * \brief Configure whether wasmtime should compile a module using multiple threads.
+ * \brief Configure whether wasmtime should compile a module using multiple
+ * threads.
  *
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.parallel_compilation.
@@ -239,13 +240,15 @@ WASMTIME_CONFIG_PROP(void, parallel_compilation, bool)
 WASMTIME_CONFIG_PROP(void, cranelift_debug_verifier, bool)
 
 /**
- * \brief Configures whether Cranelift should perform a NaN-canonicalization pass.
+ * \brief Configures whether Cranelift should perform a NaN-canonicalization
+ * pass.
  *
  * When Cranelift is used as a code generation backend this will configure
  * it to replace NaNs with a single canonical value. This is useful for users
  * requiring entirely deterministic WebAssembly computation.
  *
- * This is not required by the WebAssembly spec, so it is not enabled by default.
+ * This is not required by the WebAssembly spec, so it is not enabled by
+ * default.
  *
  * The default value for this is `false`
  */
@@ -300,7 +303,8 @@ WASMTIME_CONFIG_PROP(void, static_memory_guard_size, uint64_t)
 WASMTIME_CONFIG_PROP(void, dynamic_memory_guard_size, uint64_t)
 
 /**
- * \brief Configures the size, in bytes, of the extra virtual memory space reserved after a “dynamic” memory for growing into.
+ * \brief Configures the size, in bytes, of the extra virtual memory space
+ * reserved after a “dynamic” memory for growing into.
  *
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.dynamic_memory_reserved_for_growth
@@ -308,7 +312,8 @@ WASMTIME_CONFIG_PROP(void, dynamic_memory_guard_size, uint64_t)
 WASMTIME_CONFIG_PROP(void, dynamic_memory_reserved_for_growth, uint64_t)
 
 /**
- * \brief Configures whether to generate native unwind information (e.g. .eh_frame on Linux).
+ * \brief Configures whether to generate native unwind information (e.g.
+ * .eh_frame on Linux).
  *
  * This option defaults to true.
  *
@@ -329,7 +334,8 @@ WASMTIME_CONFIG_PROP(void, native_unwind_info, bool)
  * An error is returned if the cache configuration could not be loaded or if the
  * cache could not be enabled.
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_config_cache_config_load(wasm_config_t*, const char*);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_config_cache_config_load(wasm_config_t *, const char *);
 
 /**
  * \brief Configures the target triple that this configuration will produce
@@ -343,7 +349,7 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_config_cache_config_load(wasm_config_
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.config
  */
-WASMTIME_CONFIG_PROP(wasmtime_error_t*, target, const char*)
+WASMTIME_CONFIG_PROP(wasmtime_error_t *, target, const char *)
 
 /**
  * \brief Enables a target-specific flag in Cranelift.
@@ -354,7 +360,8 @@ WASMTIME_CONFIG_PROP(wasmtime_error_t*, target, const char*)
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.cranelift_flag_enable
  */
-WASM_API_EXTERN void wasmtime_config_cranelift_flag_enable(wasm_config_t*, const char*);
+WASM_API_EXTERN void wasmtime_config_cranelift_flag_enable(wasm_config_t *,
+                                                           const char *);
 
 /**
  * \brief Sets a target-specific flag in Cranelift to the specified value.
@@ -365,11 +372,13 @@ WASM_API_EXTERN void wasmtime_config_cranelift_flag_enable(wasm_config_t*, const
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.cranelift_flag_set
  */
-WASM_API_EXTERN void wasmtime_config_cranelift_flag_set(wasm_config_t*, const char *key, const char *value);
+WASM_API_EXTERN void wasmtime_config_cranelift_flag_set(wasm_config_t *,
+                                                        const char *key,
+                                                        const char *value);
 
 /**
- * \brief Configures whether, when on macOS, Mach ports are used for exception handling
- * instead of traditional Unix-based signal handling.
+ * \brief Configures whether, when on macOS, Mach ports are used for exception
+ * handling instead of traditional Unix-based signal handling.
  *
  * This option defaults to true, using Mach ports by default.
  *
@@ -378,20 +387,17 @@ WASM_API_EXTERN void wasmtime_config_cranelift_flag_set(wasm_config_t*, const ch
  */
 WASMTIME_CONFIG_PROP(void, macos_use_mach_ports, bool)
 
-
 /**
  * Return the data from a LinearMemory instance.
  *
- * The size in bytes as well as the maximum number of bytes that can be allocated should be
- * returned as well.
+ * The size in bytes as well as the maximum number of bytes that can be
+ * allocated should be returned as well.
  *
  * For more information about see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/trait.LinearMemory.html
  */
-typedef uint8_t *(*wasmtime_memory_get_callback_t)(
-    void *env,
-    size_t *byte_size,
-    size_t *maximum_byte_size);
+typedef uint8_t *(*wasmtime_memory_get_callback_t)(void *env, size_t *byte_size,
+                                                   size_t *maximum_byte_size);
 
 /**
  * Grow the memory to the `new_size` in bytes.
@@ -399,9 +405,8 @@ typedef uint8_t *(*wasmtime_memory_get_callback_t)(
  * For more information about the parameters see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/trait.LinearMemory.html#tymethod.grow_to
  */
-typedef wasmtime_error_t *(*wasmtime_memory_grow_callback_t)(
-    void *env,
-    size_t new_size);
+typedef wasmtime_error_t *(*wasmtime_memory_grow_callback_t)(void *env,
+                                                             size_t new_size);
 
 /**
  * A LinearMemory instance created from a #wasmtime_new_memory_callback_t.
@@ -417,14 +422,14 @@ typedef struct wasmtime_linear_memory {
   /// Callback to request growing the memory
   wasmtime_memory_grow_callback_t grow_memory;
   /// An optional finalizer for env
-  void (*finalizer)(void*);
+  void (*finalizer)(void *);
 } wasmtime_linear_memory_t;
 
 /**
  * A callback to create a new LinearMemory from the specified parameters.
  *
- * The result should be written to `memory_ret` and wasmtime will own the values written
- * into that struct.
+ * The result should be written to `memory_ret` and wasmtime will own the values
+ * written into that struct.
  *
  * This callback must be thread-safe.
  *
@@ -432,53 +437,54 @@ typedef struct wasmtime_linear_memory {
  * https://docs.wasmtime.dev/api/wasmtime/trait.MemoryCreator.html#tymethod.new_memory
  */
 typedef wasmtime_error_t *(*wasmtime_new_memory_callback_t)(
-    void *env,
-    const wasm_memorytype_t *ty,
-    size_t minimum,
-    size_t maximum,
-    size_t reserved_size_in_bytes,
-    size_t guard_size_in_bytes,
+    void *env, const wasm_memorytype_t *ty, size_t minimum, size_t maximum,
+    size_t reserved_size_in_bytes, size_t guard_size_in_bytes,
     wasmtime_linear_memory_t *memory_ret);
 
 /**
- * A representation of custom memory creator and methods for an instance of LinearMemory.
+ * A representation of custom memory creator and methods for an instance of
+ * LinearMemory.
  *
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/trait.MemoryCreator.html
  */
 typedef struct wasmtime_memory_creator {
   /// User provided value to be passed to new_memory
-  void* env;
+  void *env;
   /// The callback to create new memory, must be thread safe
   wasmtime_new_memory_callback_t new_memory;
   /// An optional finalizer for env.
-  void (*finalizer)(void*);
+  void (*finalizer)(void *);
 } wasmtime_memory_creator_t;
 
 /**
  * Sets a custom memory creator.
  *
- * Custom memory creators are used when creating host Memory objects or when creating instance
- * linear memories for the on-demand instance allocation strategy.
+ * Custom memory creators are used when creating host Memory objects or when
+ * creating instance linear memories for the on-demand instance allocation
+ * strategy.
  *
- * The config does **not** take ownership of the #wasmtime_memory_creator_t passed in, but
- * instead copies all the values in the struct.
+ * The config does **not** take ownership of the #wasmtime_memory_creator_t
+ * passed in, but instead copies all the values in the struct.
  *
  * For more information see the Rust documentation at
  * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.with_host_memory
  */
-WASM_API_EXTERN void wasmtime_config_host_memory_creator_set(
-    wasm_config_t*,
-    wasmtime_memory_creator_t*);
+WASM_API_EXTERN void
+wasmtime_config_host_memory_creator_set(wasm_config_t *,
+                                        wasmtime_memory_creator_t *);
 
 /**
- * \brief Configures whether copy-on-write memory-mapped data is used to initialize a linear memory.
+ * \brief Configures whether copy-on-write memory-mapped data is used to
+ * initialize a linear memory.
  *
- * Initializing linear memory via a copy-on-write mapping can drastically improve instantiation costs
- * of a WebAssembly module because copying memory is deferred. Additionally if a page of memory is
- * only ever read from WebAssembly and never written too then the same underlying page of data will
- * be reused between all instantiations of a module meaning that if a module is instantiated many
- * times this can lower the overall memory required needed to run that module.
+ * Initializing linear memory via a copy-on-write mapping can drastically
+ * improve instantiation costs of a WebAssembly module because copying memory is
+ * deferred. Additionally if a page of memory is only ever read from WebAssembly
+ * and never written too then the same underlying page of data will be reused
+ * between all instantiations of a module meaning that if a module is
+ * instantiated many times this can lower the overall memory required needed to
+ * run that module.
  *
  * This option defaults to true.
  *
@@ -488,8 +494,7 @@ WASM_API_EXTERN void wasmtime_config_host_memory_creator_set(
 WASMTIME_CONFIG_PROP(void, memory_init_cow, bool)
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_CONFIG_H
-
diff --git a/crates/c-api/include/wasmtime/engine.h b/crates/c-api/include/wasmtime/engine.h
index 1b8336f46..d68cf4e8f 100644
--- a/crates/c-api/include/wasmtime/engine.h
+++ b/crates/c-api/include/wasmtime/engine.h
@@ -28,9 +28,7 @@ extern "C" {
 WASM_API_EXTERN void wasmtime_engine_increment_epoch(wasm_engine_t *engine);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_ENGINE_H
-
-
diff --git a/crates/c-api/include/wasmtime/error.h b/crates/c-api/include/wasmtime/error.h
index 517755206..ad9172543 100644
--- a/crates/c-api/include/wasmtime/error.h
+++ b/crates/c-api/include/wasmtime/error.h
@@ -33,7 +33,7 @@ typedef struct wasmtime_error wasmtime_error_t;
 /**
  * \brief Creates a new error with the provided message.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_error_new(const char*);
+WASM_API_EXTERN wasmtime_error_t *wasmtime_error_new(const char *);
 
 /**
  * \brief Deletes an error.
@@ -48,10 +48,8 @@ WASM_API_EXTERN void wasmtime_error_delete(wasmtime_error_t *error);
  * uninitialized before this function is called and the caller is responsible
  * for deallocating it with #wasm_byte_vec_delete afterwards.
  */
-WASM_API_EXTERN void wasmtime_error_message(
-    const wasmtime_error_t *error,
-    wasm_name_t *message
-);
+WASM_API_EXTERN void wasmtime_error_message(const wasmtime_error_t *error,
+                                            wasm_name_t *message);
 
 /**
  * \brief Attempts to extract a WASI-specific exit status from this error.
@@ -60,7 +58,8 @@ WASM_API_EXTERN void wasmtime_error_message(
  * If `true` is returned then the exit status is returned through the `status`
  * pointer. If `false` is returned then this is not a wasi exit trap.
  */
-WASM_API_EXTERN bool wasmtime_error_exit_status(const wasmtime_error_t*, int *status);
+WASM_API_EXTERN bool wasmtime_error_exit_status(const wasmtime_error_t *,
+                                                int *status);
 
 /**
  * \brief Attempts to extract a WebAssembly trace from this error.
@@ -69,10 +68,11 @@ WASM_API_EXTERN bool wasmtime_error_exit_status(const wasmtime_error_t*, int *st
  * as input. The `out` argument will be filled in with the wasm trace, if
  * present.
  */
-WASM_API_EXTERN void wasmtime_error_wasm_trace(const wasmtime_error_t*, wasm_frame_vec_t *out);
+WASM_API_EXTERN void wasmtime_error_wasm_trace(const wasmtime_error_t *,
+                                               wasm_frame_vec_t *out);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_ERROR_H
diff --git a/crates/c-api/include/wasmtime/extern.h b/crates/c-api/include/wasmtime/extern.h
index 29dcb217f..427c5ba7f 100644
--- a/crates/c-api/include/wasmtime/extern.h
+++ b/crates/c-api/include/wasmtime/extern.h
@@ -97,14 +97,14 @@ typedef uint8_t wasmtime_extern_kind_t;
  * various kinds of items an extern wasm item can be.
  */
 typedef union wasmtime_extern_union {
-    /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_FUNC
-    wasmtime_func_t func;
-    /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_GLOBAL
-    wasmtime_global_t global;
-    /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_TABLE
-    wasmtime_table_t table;
-    /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_MEMORY
-    wasmtime_memory_t memory;
+  /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_FUNC
+  wasmtime_func_t func;
+  /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_GLOBAL
+  wasmtime_global_t global;
+  /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_TABLE
+  wasmtime_table_t table;
+  /// Field used if #wasmtime_extern_t::kind is #WASMTIME_EXTERN_MEMORY
+  wasmtime_memory_t memory;
 } wasmtime_extern_union_t;
 
 /**
@@ -121,10 +121,10 @@ typedef union wasmtime_extern_union {
  * deallocate the value.
  */
 typedef struct wasmtime_extern {
-    /// Discriminant of which field of #of is valid.
-    wasmtime_extern_kind_t kind;
-    /// Container for the extern item's value.
-    wasmtime_extern_union_t of;
+  /// Discriminant of which field of #of is valid.
+  wasmtime_extern_kind_t kind;
+  /// Container for the extern item's value.
+  wasmtime_extern_union_t of;
 } wasmtime_extern_t;
 
 /// \brief Deletes a #wasmtime_extern_t.
@@ -135,11 +135,11 @@ void wasmtime_extern_delete(wasmtime_extern_t *val);
 ///
 /// Does not take ownership of `context` or `val`, but the returned
 /// #wasm_externtype_t is an owned value that needs to be deleted.
-wasm_externtype_t *wasmtime_extern_type(wasmtime_context_t *context, wasmtime_extern_t *val);
+wasm_externtype_t *wasmtime_extern_type(wasmtime_context_t *context,
+                                        wasmtime_extern_t *val);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_EXTERN_H
-
diff --git a/crates/c-api/include/wasmtime/func.h b/crates/c-api/include/wasmtime/func.h
index c5b927fd7..41ff907c3 100644
--- a/crates/c-api/include/wasmtime/func.h
+++ b/crates/c-api/include/wasmtime/func.h
@@ -8,9 +8,9 @@
 #define WASMTIME_FUNC_H
 
 #include <wasm.h>
-#include <wasmtime/val.h>
-#include <wasmtime/store.h>
 #include <wasmtime/extern.h>
+#include <wasmtime/store.h>
+#include <wasmtime/val.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -54,13 +54,9 @@ typedef struct wasmtime_caller wasmtime_caller_t;
  * should be raised in WebAssembly. It's expected that in this case the caller
  * relinquishes ownership of the trap and it is passed back to the engine.
  */
-typedef wasm_trap_t* (*wasmtime_func_callback_t)(
-    void *env,
-    wasmtime_caller_t* caller,
-    const wasmtime_val_t *args,
-    size_t nargs,
-    wasmtime_val_t *results,
-    size_t nresults);
+typedef wasm_trap_t *(*wasmtime_func_callback_t)(
+    void *env, wasmtime_caller_t *caller, const wasmtime_val_t *args,
+    size_t nargs, wasmtime_val_t *results, size_t nresults);
 
 /**
  * \brief Creates a new host-defined function.
@@ -78,14 +74,11 @@ typedef wasm_trap_t* (*wasmtime_func_callback_t)(
  *
  * The returned function can only be used with the specified `store`.
  */
-WASM_API_EXTERN void wasmtime_func_new(
-  wasmtime_context_t *store,
-  const wasm_functype_t* type,
-  wasmtime_func_callback_t callback,
-  void *env,
-  void (*finalizer)(void*),
-  wasmtime_func_t *ret
-);
+WASM_API_EXTERN void wasmtime_func_new(wasmtime_context_t *store,
+                                       const wasm_functype_t *type,
+                                       wasmtime_func_callback_t callback,
+                                       void *env, void (*finalizer)(void *),
+                                       wasmtime_func_t *ret);
 
 /**
  * \brief Callback signature for #wasmtime_func_new_unchecked.
@@ -120,10 +113,8 @@ WASM_API_EXTERN void wasmtime_func_new(
  * array. Results are also written starting at index 0, which will overwrite
  * the arguments.
  */
-typedef wasm_trap_t* (*wasmtime_func_unchecked_callback_t)(
-    void *env,
-    wasmtime_caller_t* caller,
-    wasmtime_val_raw_t *args_and_results,
+typedef wasm_trap_t *(*wasmtime_func_unchecked_callback_t)(
+    void *env, wasmtime_caller_t *caller, wasmtime_val_raw_t *args_and_results,
     size_t num_args_and_results);
 
 /**
@@ -151,23 +142,18 @@ typedef wasm_trap_t* (*wasmtime_func_unchecked_callback_t)(
  * existence).
  */
 WASM_API_EXTERN void wasmtime_func_new_unchecked(
-  wasmtime_context_t *store,
-  const wasm_functype_t* type,
-  wasmtime_func_unchecked_callback_t callback,
-  void *env,
-  void (*finalizer)(void*),
-  wasmtime_func_t *ret
-);
+    wasmtime_context_t *store, const wasm_functype_t *type,
+    wasmtime_func_unchecked_callback_t callback, void *env,
+    void (*finalizer)(void *), wasmtime_func_t *ret);
 
 /**
  * \brief Returns the type of the function specified
  *
  * The returned #wasm_functype_t is owned by the caller.
  */
-WASM_API_EXTERN wasm_functype_t* wasmtime_func_type(
-    const wasmtime_context_t *store,
-    const wasmtime_func_t *func
-);
+WASM_API_EXTERN wasm_functype_t *
+wasmtime_func_type(const wasmtime_context_t *store,
+                   const wasmtime_func_t *func);
 
 /**
  * \brief Call a WebAssembly function.
@@ -204,15 +190,11 @@ WASM_API_EXTERN wasm_functype_t* wasmtime_func_type(
  * Does not take ownership of #wasmtime_val_t arguments. Gives ownership of
  * #wasmtime_val_t results.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_func_call(
-    wasmtime_context_t *store,
-    const wasmtime_func_t *func,
-    const wasmtime_val_t *args,
-    size_t nargs,
-    wasmtime_val_t *results,
-    size_t nresults,
-    wasm_trap_t **trap
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_func_call(wasmtime_context_t *store, const wasmtime_func_t *func,
+                   const wasmtime_val_t *args, size_t nargs,
+                   wasmtime_val_t *results, size_t nresults,
+                   wasm_trap_t **trap);
 
 /**
  * \brief Call a WebAssembly function in an "unchecked" fashion.
@@ -243,13 +225,11 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_func_call(
  * faster than that function, but the tradeoff is that embeddings must uphold
  * more invariants rather than relying on Wasmtime to check them for you.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_func_call_unchecked(
-    wasmtime_context_t *store,
-    const wasmtime_func_t *func,
-    wasmtime_val_raw_t *args_and_results,
-    size_t args_and_results_len,
-    wasm_trap_t **trap
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_func_call_unchecked(wasmtime_context_t *store,
+                             const wasmtime_func_t *func,
+                             wasmtime_val_raw_t *args_and_results,
+                             size_t args_and_results_len, wasm_trap_t **trap);
 
 /**
  * \brief Loads a #wasmtime_extern_t from the caller's context
@@ -269,17 +249,16 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_func_call_unchecked(
  * Returns a nonzero value if the export was found, or 0 if the export wasn't
  * found. If the export wasn't found then `item` isn't written to.
  */
-WASM_API_EXTERN bool wasmtime_caller_export_get(
-    wasmtime_caller_t *caller,
-    const char *name,
-    size_t name_len,
-    wasmtime_extern_t *item
-);
+WASM_API_EXTERN bool wasmtime_caller_export_get(wasmtime_caller_t *caller,
+                                                const char *name,
+                                                size_t name_len,
+                                                wasmtime_extern_t *item);
 
 /**
  * \brief Returns the store context of the caller object.
  */
-WASM_API_EXTERN wasmtime_context_t* wasmtime_caller_context(wasmtime_caller_t* caller);
+WASM_API_EXTERN wasmtime_context_t *
+wasmtime_caller_context(wasmtime_caller_t *caller);
 
 /**
  * \brief Converts a `raw` nonzero `funcref` value from #wasmtime_val_raw_t
@@ -294,21 +273,18 @@ WASM_API_EXTERN wasmtime_context_t* wasmtime_caller_context(wasmtime_caller_t* c
  * #wasmtime_context_t that they were produced from. Providing arbitrary values
  * to `raw` here or cross-context values with `context` is UB.
  */
-WASM_API_EXTERN void wasmtime_func_from_raw(
-    wasmtime_context_t* context,
-    void *raw,
-    wasmtime_func_t *ret);
+WASM_API_EXTERN void wasmtime_func_from_raw(wasmtime_context_t *context,
+                                            void *raw, wasmtime_func_t *ret);
 
 /**
  * \brief Converts a `func`  which belongs to `context` into a `usize`
  * parameter that is suitable for insertion into a #wasmtime_val_raw_t.
  */
-WASM_API_EXTERN void *wasmtime_func_to_raw(
-    wasmtime_context_t* context,
-    const wasmtime_func_t *func);
+WASM_API_EXTERN void *wasmtime_func_to_raw(wasmtime_context_t *context,
+                                           const wasmtime_func_t *func);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_FUNC_H
diff --git a/crates/c-api/include/wasmtime/global.h b/crates/c-api/include/wasmtime/global.h
index 4e244285a..5d69c19f5 100644
--- a/crates/c-api/include/wasmtime/global.h
+++ b/crates/c-api/include/wasmtime/global.h
@@ -33,22 +33,18 @@ extern "C" {
  * This function does not take ownership of any of its arguments but error is
  * owned by the caller.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_global_new(
-    wasmtime_context_t *store,
-    const wasm_globaltype_t *type,
-    const wasmtime_val_t *val,
-    wasmtime_global_t *ret
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_global_new(wasmtime_context_t *store, const wasm_globaltype_t *type,
+                    const wasmtime_val_t *val, wasmtime_global_t *ret);
 
 /**
  * \brief Returns the wasm type of the specified global.
  *
  * The returned #wasm_globaltype_t is owned by the caller.
  */
-WASM_API_EXTERN wasm_globaltype_t* wasmtime_global_type(
-    const wasmtime_context_t *store,
-    const wasmtime_global_t *global
-);
+WASM_API_EXTERN wasm_globaltype_t *
+wasmtime_global_type(const wasmtime_context_t *store,
+                     const wasmtime_global_t *global);
 
 /**
  * \brief Get the value of the specified global.
@@ -60,11 +56,9 @@ WASM_API_EXTERN wasm_globaltype_t* wasmtime_global_type(
  * This function returns ownership of the contents of `out`, so
  * #wasmtime_val_delete may need to be called on the value.
  */
-WASM_API_EXTERN void wasmtime_global_get(
-    wasmtime_context_t *store,
-    const wasmtime_global_t *global,
-    wasmtime_val_t *out
-);
+WASM_API_EXTERN void wasmtime_global_get(wasmtime_context_t *store,
+                                         const wasmtime_global_t *global,
+                                         wasmtime_val_t *out);
 
 /**
  * \brief Sets a global to a new value.
@@ -76,16 +70,15 @@ WASM_API_EXTERN void wasmtime_global_get(
  * This function may return an error if `global` is not mutable or if `val` has
  * the wrong type for `global`.
  *
- * THis does not take ownership of any argument but returns ownership of the error.
+ * THis does not take ownership of any argument but returns ownership of the
+ * error.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_global_set(
-    wasmtime_context_t *store,
-    const wasmtime_global_t *global,
-    const wasmtime_val_t *val
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_global_set(wasmtime_context_t *store, const wasmtime_global_t *global,
+                    const wasmtime_val_t *val);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_GLOBAL_H
diff --git a/crates/c-api/include/wasmtime/instance.h b/crates/c-api/include/wasmtime/instance.h
index c76b39e28..0d63cfb7a 100644
--- a/crates/c-api/include/wasmtime/instance.h
+++ b/crates/c-api/include/wasmtime/instance.h
@@ -62,14 +62,11 @@ typedef struct wasmtime_instance {
  * This function does not take ownership of any of its arguments, but all return
  * values are owned by the caller.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_instance_new(
-    wasmtime_context_t *store,
-    const wasmtime_module_t *module,
-    const wasmtime_extern_t* imports,
-    size_t nimports,
-    wasmtime_instance_t *instance,
-    wasm_trap_t **trap
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_instance_new(wasmtime_context_t *store,
+                      const wasmtime_module_t *module,
+                      const wasmtime_extern_t *imports, size_t nimports,
+                      wasmtime_instance_t *instance, wasm_trap_t **trap);
 
 /**
  * \brief Get an export by name from an instance.
@@ -87,12 +84,8 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_instance_new(
  * #wasmtime_extern_t.
  */
 WASM_API_EXTERN bool wasmtime_instance_export_get(
-    wasmtime_context_t *store,
-    const wasmtime_instance_t *instance,
-    const char *name,
-    size_t name_len,
-    wasmtime_extern_t *item
-);
+    wasmtime_context_t *store, const wasmtime_instance_t *instance,
+    const char *name, size_t name_len, wasmtime_extern_t *item);
 
 /**
  * \brief Get an export by index from an instance.
@@ -113,16 +106,12 @@ WASM_API_EXTERN bool wasmtime_instance_export_get(
  * #wasmtime_context_t.
  */
 WASM_API_EXTERN bool wasmtime_instance_export_nth(
-    wasmtime_context_t *store,
-    const wasmtime_instance_t *instance,
-    size_t index,
-    char **name,
-    size_t *name_len,
-    wasmtime_extern_t *item
-);
+    wasmtime_context_t *store, const wasmtime_instance_t *instance,
+    size_t index, char **name, size_t *name_len, wasmtime_extern_t *item);
 
 /**
- * \brief A #wasmtime_instance_t, pre-instantiation, that is ready to be instantiated.
+ * \brief A #wasmtime_instance_t, pre-instantiation, that is ready to be
+ * instantiated.
  *
  * Must be deleted using #wasmtime_instance_pre_delete.
  *
@@ -160,11 +149,9 @@ wasmtime_instance_pre_delete(wasmtime_instance_pre_t *instance_pre);
  * This function does not take ownership of any of its arguments, and all return
  * values are owned by the caller.
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_instance_pre_instantiate(
-    const wasmtime_instance_pre_t* instance_pre,
-    wasmtime_store_t *store,
-    wasmtime_instance_t* instance,
-    wasm_trap_t **trap_ptr);
+WASM_API_EXTERN wasmtime_error_t *wasmtime_instance_pre_instantiate(
+    const wasmtime_instance_pre_t *instance_pre, wasmtime_store_t *store,
+    wasmtime_instance_t *instance, wasm_trap_t **trap_ptr);
 
 /**
  * \brief Get the module (as a shallow clone) for a instance_pre.
@@ -172,11 +159,11 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_instance_pre_instantiate(
  * The returned module is owned by the caller and the caller **must**
  * delete it via `wasmtime_module_delete`.
  */
-WASM_API_EXTERN wasmtime_module_t*
+WASM_API_EXTERN wasmtime_module_t *
 wasmtime_instance_pre_module(wasmtime_instance_pre_t *instance_pre);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_INSTANCE_H
diff --git a/crates/c-api/include/wasmtime/linker.h b/crates/c-api/include/wasmtime/linker.h
index 750c18d85..c70423495 100644
--- a/crates/c-api/include/wasmtime/linker.h
+++ b/crates/c-api/include/wasmtime/linker.h
@@ -9,8 +9,8 @@
 
 #include <wasm.h>
 #include <wasmtime/error.h>
-#include <wasmtime/store.h>
 #include <wasmtime/extern.h>
+#include <wasmtime/store.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,12 +40,12 @@ typedef struct wasmtime_linker wasmtime_linker_t;
  * This function does not take ownership of the engine argument, and the caller
  * is expected to delete the returned linker.
  */
-WASM_API_EXTERN wasmtime_linker_t* wasmtime_linker_new(wasm_engine_t* engine);
+WASM_API_EXTERN wasmtime_linker_t *wasmtime_linker_new(wasm_engine_t *engine);
 
 /**
  * \brief Deletes a linker
  */
-WASM_API_EXTERN void wasmtime_linker_delete(wasmtime_linker_t* linker);
+WASM_API_EXTERN void wasmtime_linker_delete(wasmtime_linker_t *linker);
 
 /**
  * \brief Configures whether this linker allows later definitions to shadow
@@ -53,7 +53,8 @@ WASM_API_EXTERN void wasmtime_linker_delete(wasmtime_linker_t* linker);
  *
  * By default this setting is `false`.
  */
-WASM_API_EXTERN void wasmtime_linker_allow_shadowing(wasmtime_linker_t* linker, bool allow_shadowing);
+WASM_API_EXTERN void wasmtime_linker_allow_shadowing(wasmtime_linker_t *linker,
+                                                     bool allow_shadowing);
 
 /**
  * \brief Defines a new item in this linker.
@@ -72,15 +73,10 @@ WASM_API_EXTERN void wasmtime_linker_allow_shadowing(wasmtime_linker_t* linker,
  * For more information about name resolution consult the [Rust
  * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#name-resolution).
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define(
-    wasmtime_linker_t *linker,
-    wasmtime_context_t *store,
-    const char *module,
-    size_t module_len,
-    const char *name,
-    size_t name_len,
-    const wasmtime_extern_t *item
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_linker_define(wasmtime_linker_t *linker, wasmtime_context_t *store,
+                       const char *module, size_t module_len, const char *name,
+                       size_t name_len, const wasmtime_extern_t *item);
 
 /**
  * \brief Defines a new function in this linker.
@@ -92,7 +88,8 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define(
  * \param name_len the byte length of `name`
  * \param ty the type of the function that's being defined
  * \param cb the host callback to invoke when the function is called
- * \param data the host-provided data to provide as the first argument to the callback
+ * \param data the host-provided data to provide as the first argument to the
+ *        callback
  * \param finalizer an optional finalizer for the `data` argument.
  *
  * \return On success `NULL` is returned, otherwise an error is returned which
@@ -107,17 +104,10 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define(
  *
  * For more information about host callbacks see #wasmtime_func_new.
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_func(
-    wasmtime_linker_t *linker,
-    const char *module,
-    size_t module_len,
-    const char *name,
-    size_t name_len,
-    const wasm_functype_t *ty,
-    wasmtime_func_callback_t cb,
-    void *data,
-    void (*finalizer)(void*)
-);
+WASM_API_EXTERN wasmtime_error_t *wasmtime_linker_define_func(
+    wasmtime_linker_t *linker, const char *module, size_t module_len,
+    const char *name, size_t name_len, const wasm_functype_t *ty,
+    wasmtime_func_callback_t cb, void *data, void (*finalizer)(void *));
 
 /**
  * \brief Defines a new function in this linker.
@@ -128,17 +118,11 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_func(
  * information as well as #wasmtime_func_new_unchecked for why this is an
  * unsafe API.
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_func_unchecked(
-    wasmtime_linker_t *linker,
-    const char *module,
-    size_t module_len,
-    const char *name,
-    size_t name_len,
-    const wasm_functype_t *ty,
-    wasmtime_func_unchecked_callback_t cb,
-    void *data,
-    void (*finalizer)(void*)
-);
+WASM_API_EXTERN wasmtime_error_t *wasmtime_linker_define_func_unchecked(
+    wasmtime_linker_t *linker, const char *module, size_t module_len,
+    const char *name, size_t name_len, const wasm_functype_t *ty,
+    wasmtime_func_unchecked_callback_t cb, void *data,
+    void (*finalizer)(void *));
 
 /**
  * \brief Defines WASI functions in this linker.
@@ -157,9 +141,8 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_func_unchecked(
  * For more information about name resolution consult the [Rust
  * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#name-resolution).
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_wasi(
-    wasmtime_linker_t *linker
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_linker_define_wasi(wasmtime_linker_t *linker);
 
 /**
  * \brief Defines an instance under the specified name in this linker.
@@ -180,13 +163,9 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_wasi(
  * For more information about name resolution consult the [Rust
  * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#name-resolution).
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_instance(
-    wasmtime_linker_t *linker,
-    wasmtime_context_t *store,
-    const char *name,
-    size_t name_len,
-    const wasmtime_instance_t *instance
-);
+WASM_API_EXTERN wasmtime_error_t *wasmtime_linker_define_instance(
+    wasmtime_linker_t *linker, wasmtime_context_t *store, const char *name,
+    size_t name_len, const wasmtime_instance_t *instance);
 
 /**
  * \brief Instantiates a #wasm_module_t with the items defined in this linker.
@@ -210,13 +189,11 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_define_instance(
  * defined in the linker than an error is returned. (or if the previously
  * defined item is of the wrong type).
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_instantiate(
-    const wasmtime_linker_t *linker,
-    wasmtime_context_t *store,
-    const wasmtime_module_t *module,
-    wasmtime_instance_t *instance,
-    wasm_trap_t **trap
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_linker_instantiate(const wasmtime_linker_t *linker,
+                            wasmtime_context_t *store,
+                            const wasmtime_module_t *module,
+                            wasmtime_instance_t *instance, wasm_trap_t **trap);
 
 /**
  * \brief Defines automatic instantiations of a #wasm_module_t in this linker.
@@ -237,13 +214,10 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_instantiate(
  * For more information see the [Rust
  * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#method.module).
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_module(
-    wasmtime_linker_t *linker,
-    wasmtime_context_t *store,
-    const char *name,
-    size_t name_len,
-    const wasmtime_module_t *module
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_linker_module(wasmtime_linker_t *linker, wasmtime_context_t *store,
+                       const char *name, size_t name_len,
+                       const wasmtime_module_t *module);
 
 /**
  * \brief Acquires the "default export" of the named module in this linker.
@@ -260,13 +234,10 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_module(
  * For more information see the [Rust
  * documentation](https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Linker.html#method.get_default).
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_get_default(
-    const wasmtime_linker_t *linker,
-    wasmtime_context_t *store,
-    const char *name,
-    size_t name_len,
-    wasmtime_func_t *func
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_linker_get_default(const wasmtime_linker_t *linker,
+                            wasmtime_context_t *store, const char *name,
+                            size_t name_len, wasmtime_func_t *func);
 
 /**
  * \brief Loads an item by name from this linker.
@@ -282,15 +253,11 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_get_default(
  * \return A nonzero value if the item is defined, in which case `item` is also
  * filled in. Otherwise zero is returned.
  */
-WASM_API_EXTERN bool wasmtime_linker_get(
-    const wasmtime_linker_t *linker,
-    wasmtime_context_t *store,
-    const char *module,
-    size_t module_len,
-    const char *name,
-    size_t name_len,
-    wasmtime_extern_t *item
-);
+WASM_API_EXTERN bool wasmtime_linker_get(const wasmtime_linker_t *linker,
+                                         wasmtime_context_t *store,
+                                         const char *module, size_t module_len,
+                                         const char *name, size_t name_len,
+                                         wasmtime_extern_t *item);
 
 /**
  * \brief Preform all the checks for instantiating `module` with the linker,
@@ -305,13 +272,13 @@ WASM_API_EXTERN bool wasmtime_linker_get(
  * For more information see the Rust documentation at:
  * https://docs.wasmtime.dev/api/wasmtime/struct.Linker.html#method.instantiate_pre
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_linker_instantiate_pre(
-    const wasmtime_linker_t *linker,
-    const wasmtime_module_t *module,
-    wasmtime_instance_pre_t **instance_pre);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_linker_instantiate_pre(const wasmtime_linker_t *linker,
+                                const wasmtime_module_t *module,
+                                wasmtime_instance_pre_t **instance_pre);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_LINKER_H
diff --git a/crates/c-api/include/wasmtime/memory.h b/crates/c-api/include/wasmtime/memory.h
index cda42c2b8..a22b93c97 100644
--- a/crates/c-api/include/wasmtime/memory.h
+++ b/crates/c-api/include/wasmtime/memory.h
@@ -8,9 +8,9 @@
 #define WASMTIME_MEMORY_H
 
 #include <wasm.h>
+#include <wasmtime/error.h>
 #include <wasmtime/extern.h>
 #include <wasmtime/store.h>
-#include <wasmtime/error.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -22,7 +22,10 @@ extern "C" {
  * Note that this function is preferred over #wasm_memorytype_new for
  * compatibility with the memory64 proposal.
  */
-WASM_API_EXTERN wasm_memorytype_t *wasmtime_memorytype_new(uint64_t min, bool max_present, uint64_t max, bool is_64);
+WASM_API_EXTERN wasm_memorytype_t *wasmtime_memorytype_new(uint64_t min,
+                                                           bool max_present,
+                                                           uint64_t max,
+                                                           bool is_64);
 
 /**
  * \brief Returns the minimum size, in pages, of the specified memory type.
@@ -30,7 +33,8 @@ WASM_API_EXTERN wasm_memorytype_t *wasmtime_memorytype_new(uint64_t min, bool ma
  * Note that this function is preferred over #wasm_memorytype_limits for
  * compatibility with the memory64 proposal.
  */
-WASM_API_EXTERN uint64_t wasmtime_memorytype_minimum(const wasm_memorytype_t *ty);
+WASM_API_EXTERN uint64_t
+wasmtime_memorytype_minimum(const wasm_memorytype_t *ty);
 
 /**
  * \brief Returns the maximum size, in pages, of the specified memory type.
@@ -42,7 +46,8 @@ WASM_API_EXTERN uint64_t wasmtime_memorytype_minimum(const wasm_memorytype_t *ty
  * Note that this function is preferred over #wasm_memorytype_limits for
  * compatibility with the memory64 proposal.
  */
-WASM_API_EXTERN bool wasmtime_memorytype_maximum(const wasm_memorytype_t *ty, uint64_t *max);
+WASM_API_EXTERN bool wasmtime_memorytype_maximum(const wasm_memorytype_t *ty,
+                                                 uint64_t *max);
 
 /**
  * \brief Returns whether this type of memory represents a 64-bit memory.
@@ -59,43 +64,34 @@ WASM_API_EXTERN bool wasmtime_memorytype_is64(const wasm_memorytype_t *ty);
  * If an error happens when creating the memory it's returned and owned by the
  * caller. If an error happens then `ret` is not filled in.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_memory_new(
-    wasmtime_context_t *store,
-    const wasm_memorytype_t* ty,
-    wasmtime_memory_t *ret
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_memory_new(wasmtime_context_t *store, const wasm_memorytype_t *ty,
+                    wasmtime_memory_t *ret);
 
 /**
  * \brief Returns the type of the memory specified
  */
-WASM_API_EXTERN wasm_memorytype_t* wasmtime_memory_type(
-    const wasmtime_context_t *store,
-    const wasmtime_memory_t *memory
-);
+WASM_API_EXTERN wasm_memorytype_t *
+wasmtime_memory_type(const wasmtime_context_t *store,
+                     const wasmtime_memory_t *memory);
 
 /**
  * \brief Returns the base pointer in memory where the linear memory starts.
  */
-WASM_API_EXTERN uint8_t *wasmtime_memory_data(
-    const wasmtime_context_t *store,
-    const wasmtime_memory_t *memory
-);
+WASM_API_EXTERN uint8_t *wasmtime_memory_data(const wasmtime_context_t *store,
+                                              const wasmtime_memory_t *memory);
 
 /**
  * \brief Returns the byte length of this linear memory.
  */
 WASM_API_EXTERN size_t wasmtime_memory_data_size(
-    const wasmtime_context_t *store,
-    const wasmtime_memory_t *memory
-);
+    const wasmtime_context_t *store, const wasmtime_memory_t *memory);
 
 /**
  * \brief Returns the length, in WebAssembly pages, of this linear memory
  */
-WASM_API_EXTERN uint64_t wasmtime_memory_size(
-    const wasmtime_context_t *store,
-    const wasmtime_memory_t *memory
-);
+WASM_API_EXTERN uint64_t wasmtime_memory_size(const wasmtime_context_t *store,
+                                              const wasmtime_memory_t *memory);
 
 /**
  * \brief Attempts to grow the specified memory by `delta` pages.
@@ -109,15 +105,12 @@ WASM_API_EXTERN uint64_t wasmtime_memory_size(
  * returned. Otherwise `prev_size` is set to the previous size of the memory, in
  * WebAssembly pages, and `NULL` is returned.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_memory_grow(
-    wasmtime_context_t *store,
-    const wasmtime_memory_t *memory,
-    uint64_t delta,
-    uint64_t *prev_size
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_memory_grow(wasmtime_context_t *store, const wasmtime_memory_t *memory,
+                     uint64_t delta, uint64_t *prev_size);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_MEMORY_H
diff --git a/crates/c-api/include/wasmtime/module.h b/crates/c-api/include/wasmtime/module.h
index 222239e81..48f437c51 100644
--- a/crates/c-api/include/wasmtime/module.h
+++ b/crates/c-api/include/wasmtime/module.h
@@ -41,12 +41,10 @@ typedef struct wasmtime_module wasmtime_module_t;
  * This function does not take ownership of any of its arguments, but the
  * returned error and module are owned by the caller.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_module_new(
-    wasm_engine_t *engine,
-    const uint8_t *wasm,
-    size_t wasm_len,
-    wasmtime_module_t **ret
-);
+WASM_API_EXTERN wasmtime_error_t *wasmtime_module_new(wasm_engine_t *engine,
+                                                      const uint8_t *wasm,
+                                                      size_t wasm_len,
+                                                      wasmtime_module_t **ret);
 
 /**
  * \brief Deletes a module.
@@ -62,18 +60,14 @@ WASM_API_EXTERN wasmtime_module_t *wasmtime_module_clone(wasmtime_module_t *m);
 /**
  * \brief Same as #wasm_module_imports, but for #wasmtime_module_t.
  */
-WASM_API_EXTERN void wasmtime_module_imports(
-    const wasmtime_module_t *module,
-    wasm_importtype_vec_t *out
-);
+WASM_API_EXTERN void wasmtime_module_imports(const wasmtime_module_t *module,
+                                             wasm_importtype_vec_t *out);
 
 /**
  * \brief Same as #wasm_module_exports, but for #wasmtime_module_t.
  */
-WASM_API_EXTERN void wasmtime_module_exports(
-    const wasmtime_module_t *module,
-    wasm_exporttype_vec_t *out
-);
+WASM_API_EXTERN void wasmtime_module_exports(const wasmtime_module_t *module,
+                                             wasm_exporttype_vec_t *out);
 
 /**
  * \brief Validate a WebAssembly binary.
@@ -87,18 +81,16 @@ WASM_API_EXTERN void wasmtime_module_exports(
  * If the binary validates then `NULL` is returned, otherwise the error returned
  * describes why the binary did not validate.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_module_validate(
-    wasm_engine_t *engine,
-    const uint8_t *wasm,
-    size_t wasm_len
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_module_validate(wasm_engine_t *engine, const uint8_t *wasm,
+                         size_t wasm_len);
 
 /**
  * \brief This function serializes compiled module artifacts as blob data.
  *
  * \param module the module
- * \param ret if the conversion is successful, this byte vector is filled in with
- *   the serialized compiled module.
+ * \param ret if the conversion is successful, this byte vector is filled in
+ * with the serialized compiled module.
  *
  * \return a non-null error if parsing fails, or returns `NULL`. If parsing
  * fails then `ret` isn't touched.
@@ -106,10 +98,8 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_module_validate(
  * This function does not take ownership of `module`, and the caller is
  * expected to deallocate the returned #wasmtime_error_t and #wasm_byte_vec_t.
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_module_serialize(
-    wasmtime_module_t* module,
-    wasm_byte_vec_t *ret
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_module_serialize(wasmtime_module_t *module, wasm_byte_vec_t *ret);
 
 /**
  * \brief Build a module from serialized data.
@@ -121,12 +111,9 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_module_serialize(
  * documentation for more information on what inputs are safe to pass in here
  * (e.g. only that of #wasmtime_module_serialize)
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_module_deserialize(
-    wasm_engine_t *engine,
-    const uint8_t *bytes,
-    size_t bytes_len,
-    wasmtime_module_t **ret
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_module_deserialize(wasm_engine_t *engine, const uint8_t *bytes,
+                            size_t bytes_len, wasmtime_module_t **ret);
 
 /**
  * \brief Deserialize a module from an on-disk file.
@@ -142,29 +129,27 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_module_deserialize(
  * documentation for more information on what inputs are safe to pass in here
  * (e.g. only that of #wasmtime_module_serialize)
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_module_deserialize_file(
-    wasm_engine_t *engine,
-    const char *path,
-    wasmtime_module_t **ret
-);
-
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_module_deserialize_file(wasm_engine_t *engine, const char *path,
+                                 wasmtime_module_t **ret);
 
 /**
- * \brief Returns the range of bytes in memory where this module’s compilation image resides.
+ * \brief Returns the range of bytes in memory where this module’s compilation
+ * image resides.
  *
- * The compilation image for a module contains executable code, data, debug information, etc. 
- * This is roughly the same as the wasmtime_module_serialize but not the exact same.
+ * The compilation image for a module contains executable code, data, debug
+ * information, etc. This is roughly the same as the wasmtime_module_serialize
+ * but not the exact same.
  *
- * For more details see: https://docs.wasmtime.dev/api/wasmtime/struct.Module.html#method.image_range
+ * For more details see:
+ * https://docs.wasmtime.dev/api/wasmtime/struct.Module.html#method.image_range
  */
-WASM_API_EXTERN void wasmtime_module_image_range(
-    const wasmtime_module_t *module,
-    size_t *start,
-    size_t *end
-);
+WASM_API_EXTERN void
+wasmtime_module_image_range(const wasmtime_module_t *module, size_t *start,
+                            size_t *end);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_MODULE_H
diff --git a/crates/c-api/include/wasmtime/store.h b/crates/c-api/include/wasmtime/store.h
index 79f154a39..60ba3447f 100644
--- a/crates/c-api/include/wasmtime/store.h
+++ b/crates/c-api/include/wasmtime/store.h
@@ -7,8 +7,8 @@
 #ifndef WASMTIME_STORE_H
 #define WASMTIME_STORE_H
 
-#include <wasm.h>
 #include <wasi.h>
+#include <wasm.h>
 #include <wasmtime/error.h>
 
 #ifdef __cplusplus
@@ -68,16 +68,15 @@ typedef struct wasmtime_context wasmtime_context_t;
  * This function creates a fresh store with the provided configuration settings.
  * The returned store must be deleted with #wasmtime_store_delete.
  */
-WASM_API_EXTERN wasmtime_store_t *wasmtime_store_new(
-    wasm_engine_t *engine,
-    void *data,
-    void (*finalizer)(void*)
-);
+WASM_API_EXTERN wasmtime_store_t *wasmtime_store_new(wasm_engine_t *engine,
+                                                     void *data,
+                                                     void (*finalizer)(void *));
 
 /**
  * \brief Returns the interior #wasmtime_context_t pointer to this store
  */
-WASM_API_EXTERN wasmtime_context_t *wasmtime_store_context(wasmtime_store_t *store);
+WASM_API_EXTERN wasmtime_context_t *
+wasmtime_store_context(wasmtime_store_t *store);
 
 /**
  * \brief Provides limits for a store. Used by hosts to limit resource
@@ -108,14 +107,11 @@ WASM_API_EXTERN wasmtime_context_t *wasmtime_store_context(wasmtime_store_t *sto
  * resources in the future, this does not retroactively attempt to apply
  * limits to the store.
  */
-WASM_API_EXTERN void wasmtime_store_limiter(
-        wasmtime_store_t *store,
-        int64_t memory_size,
-        int64_t table_elements,
-        int64_t instances,
-        int64_t tables,
-        int64_t memories
-);
+WASM_API_EXTERN void wasmtime_store_limiter(wasmtime_store_t *store,
+                                            int64_t memory_size,
+                                            int64_t table_elements,
+                                            int64_t instances, int64_t tables,
+                                            int64_t memories);
 
 /**
  * \brief Deletes a store.
@@ -125,7 +121,8 @@ WASM_API_EXTERN void wasmtime_store_delete(wasmtime_store_t *store);
 /**
  * \brief Returns the user-specified data associated with the specified store
  */
-WASM_API_EXTERN void *wasmtime_context_get_data(const wasmtime_context_t* context);
+WASM_API_EXTERN void *
+wasmtime_context_get_data(const wasmtime_context_t *context);
 
 /**
  * \brief Overwrites the user-specified data associated with this store.
@@ -134,7 +131,8 @@ WASM_API_EXTERN void *wasmtime_context_get_data(const wasmtime_context_t* contex
  * and the original finalizer will be executed for the provided data when the
  * store is deleted.
  */
-WASM_API_EXTERN void wasmtime_context_set_data(wasmtime_context_t* context, void *data);
+WASM_API_EXTERN void wasmtime_context_set_data(wasmtime_context_t *context,
+                                               void *data);
 
 /**
  * \brief Perform garbage collection within the given context.
@@ -145,7 +143,7 @@ WASM_API_EXTERN void wasmtime_context_set_data(wasmtime_context_t* context, void
  *
  * The `context` argument must not be NULL.
  */
-WASM_API_EXTERN void wasmtime_context_gc(wasmtime_context_t* context);
+WASM_API_EXTERN void wasmtime_context_gc(wasmtime_context_t *context);
 
 /**
  * \brief Set fuel to this context's store for wasm to consume while executing.
@@ -161,7 +159,8 @@ WASM_API_EXTERN void wasmtime_context_gc(wasmtime_context_t* context);
  * If fuel is not enabled within this store then an error is returned. If fuel
  * is successfully added then NULL is returned.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_context_set_fuel(wasmtime_context_t *store, uint64_t fuel);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_context_set_fuel(wasmtime_context_t *store, uint64_t fuel);
 
 /**
  * \brief Returns the amount of fuel remaining in this context's store.
@@ -173,7 +172,8 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_context_set_fuel(wasmtime_context_t *
  * Also note that fuel, if enabled, must be originally configured via
  * #wasmtime_context_set_fuel.
  */
-WASM_API_EXTERN wasmtime_error_t* wasmtime_context_get_fuel(const wasmtime_context_t *context, uint64_t *fuel);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_context_get_fuel(const wasmtime_context_t *context, uint64_t *fuel);
 
 /**
  * \brief Configures WASI state within the specified store.
@@ -186,7 +186,8 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_context_get_fuel(const wasmtime_conte
  * of `wasi`. The caller should no longer use `wasi` after calling this function
  * (even if an error is returned).
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_context_set_wasi(wasmtime_context_t *context, wasi_config_t *wasi);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_context_set_wasi(wasmtime_context_t *context, wasi_config_t *wasi);
 
 /**
  * \brief Configures the relative deadline at which point WebAssembly code will
@@ -198,14 +199,16 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_context_set_wasi(wasmtime_context_t *
  * See also #wasmtime_config_epoch_interruption_set and
  * #wasmtime_store_epoch_deadline_callback.
  */
-WASM_API_EXTERN void wasmtime_context_set_epoch_deadline(wasmtime_context_t *context, uint64_t ticks_beyond_current);
+WASM_API_EXTERN void
+wasmtime_context_set_epoch_deadline(wasmtime_context_t *context,
+                                    uint64_t ticks_beyond_current);
 
 /// \brief An enum for the behavior before extending the epoch deadline.
 typedef uint8_t wasmtime_update_deadline_kind_t;
 /// \brief Directly continue to updating the deadline and executing WebAssembly.
 #define WASMTIME_UPDATE_DEADLINE_CONTINUE 0
 /// \brief Yield control (via async support) then update the deadline.
-#define WASMTIME_UPDATE_DEADLINE_YIELD    1
+#define WASMTIME_UPDATE_DEADLINE_YIELD 1
 
 /**
  * \brief Configures epoch deadline callback to C function.
@@ -216,32 +219,26 @@ typedef uint8_t wasmtime_update_deadline_kind_t;
  * - return a #wasmtime_error_t to terminate the function
  * - set the delta argument and return NULL to update the
  *   epoch deadline delta and resume function execution.
- * - set the delta argument, update the epoch deadline, 
+ * - set the delta argument, update the epoch deadline,
  *   set update_kind to WASMTIME_UPDATE_DEADLINE_YIELD,
- *   and return NULL to yield (via async support) and 
+ *   and return NULL to yield (via async support) and
  *   resume function execution.
  *
- * To use WASMTIME_UPDATE_DEADLINE_YIELD async support must be enabled 
+ * To use WASMTIME_UPDATE_DEADLINE_YIELD async support must be enabled
  * for this store.
  *
  * See also #wasmtime_config_epoch_interruption_set and
  * #wasmtime_context_set_epoch_deadline.
  */
 WASM_API_EXTERN void wasmtime_store_epoch_deadline_callback(
-    wasmtime_store_t *store, 
-    wasmtime_error_t* (*func)(
-      wasmtime_context_t* context, 
-      void* data, 
-      uint64_t* epoch_deadline_delta, 
-      wasmtime_update_deadline_kind_t* update_kind
-    ), 
-    void *data,
-    void (*finalizer)(void*)
-);
+    wasmtime_store_t *store,
+    wasmtime_error_t *(*func)(wasmtime_context_t *context, void *data,
+                              uint64_t *epoch_deadline_delta,
+                              wasmtime_update_deadline_kind_t *update_kind),
+    void *data, void (*finalizer)(void *));
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_STORE_H
-
diff --git a/crates/c-api/include/wasmtime/table.h b/crates/c-api/include/wasmtime/table.h
index 630cee9ec..9ec8f3796 100644
--- a/crates/c-api/include/wasmtime/table.h
+++ b/crates/c-api/include/wasmtime/table.h
@@ -8,9 +8,9 @@
 #define WASMTIME_TABLE_H
 
 #include <wasm.h>
+#include <wasmtime/error.h>
 #include <wasmtime/extern.h>
 #include <wasmtime/store.h>
-#include <wasmtime/error.h>
 #include <wasmtime/val.h>
 
 #ifdef __cplusplus
@@ -29,22 +29,19 @@ extern "C" {
  * ownership of returned error. This function may return an error if the `init`
  * value does not match `ty`, for example.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_table_new(
-    wasmtime_context_t *store,
-    const wasm_tabletype_t *ty,
-    const wasmtime_val_t *init,
-    wasmtime_table_t *table
-);
+WASM_API_EXTERN wasmtime_error_t *wasmtime_table_new(wasmtime_context_t *store,
+                                                     const wasm_tabletype_t *ty,
+                                                     const wasmtime_val_t *init,
+                                                     wasmtime_table_t *table);
 
 /**
  * \brief Returns the type of this table.
  *
  * The caller has ownership of the returned #wasm_tabletype_t
  */
-WASM_API_EXTERN wasm_tabletype_t* wasmtime_table_type(
-    const wasmtime_context_t *store,
-    const wasmtime_table_t *table
-);
+WASM_API_EXTERN wasm_tabletype_t *
+wasmtime_table_type(const wasmtime_context_t *store,
+                    const wasmtime_table_t *table);
 
 /**
  * \brief Gets a value in a table.
@@ -58,12 +55,9 @@ WASM_API_EXTERN wasm_tabletype_t* wasmtime_table_type(
  * returned then `val` is filled in and is owned by the caller. Otherwise zero
  * is returned because the `index` is out-of-bounds.
  */
-WASM_API_EXTERN bool wasmtime_table_get(
-    wasmtime_context_t *store,
-    const wasmtime_table_t *table,
-    uint32_t index,
-    wasmtime_val_t *val
-);
+WASM_API_EXTERN bool wasmtime_table_get(wasmtime_context_t *store,
+                                        const wasmtime_table_t *table,
+                                        uint32_t index, wasmtime_val_t *val);
 
 /**
  * \brief Sets a value in a table.
@@ -78,20 +72,15 @@ WASM_API_EXTERN bool wasmtime_table_get(
  * This function can fail if `value` has the wrong type for the table, or if
  * `index` is out of bounds.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_table_set(
-    wasmtime_context_t *store,
-    const wasmtime_table_t *table,
-    uint32_t index,
-    const wasmtime_val_t *value
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_table_set(wasmtime_context_t *store, const wasmtime_table_t *table,
+                   uint32_t index, const wasmtime_val_t *value);
 
 /**
  * \brief Returns the size, in elements, of the specified table
  */
-WASM_API_EXTERN uint32_t wasmtime_table_size(
-    const wasmtime_context_t *store,
-    const wasmtime_table_t *table
-);
+WASM_API_EXTERN uint32_t wasmtime_table_size(const wasmtime_context_t *store,
+                                             const wasmtime_table_t *table);
 
 /**
  * \brief Grows a table.
@@ -110,17 +99,13 @@ WASM_API_EXTERN uint32_t wasmtime_table_size(
  *
  * This function does not take ownership of any of its arguments.
  */
-WASM_API_EXTERN wasmtime_error_t *wasmtime_table_grow(
-    wasmtime_context_t *store,
-    const wasmtime_table_t *table,
-    uint32_t delta,
-    const wasmtime_val_t *init,
-    uint32_t *prev_size
-);
+WASM_API_EXTERN wasmtime_error_t *
+wasmtime_table_grow(wasmtime_context_t *store, const wasmtime_table_t *table,
+                    uint32_t delta, const wasmtime_val_t *init,
+                    uint32_t *prev_size);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_TABLE_H
-
diff --git a/crates/c-api/include/wasmtime/trap.h b/crates/c-api/include/wasmtime/trap.h
index 2d2e20407..0d2385bb0 100644
--- a/crates/c-api/include/wasmtime/trap.h
+++ b/crates/c-api/include/wasmtime/trap.h
@@ -28,7 +28,8 @@ enum wasmtime_trap_code_enum {
   WASMTIME_TRAP_CODE_STACK_OVERFLOW,
   /// An out-of-bounds memory access.
   WASMTIME_TRAP_CODE_MEMORY_OUT_OF_BOUNDS,
-  /// A wasm atomic operation was presented with a not-naturally-aligned linear-memory address.
+  /// A wasm atomic operation was presented with a not-naturally-aligned
+  /// linear-memory address.
   WASMTIME_TRAP_CODE_HEAP_MISALIGNED,
   /// An out-of-bounds access to a table.
   WASMTIME_TRAP_CODE_TABLE_OUT_OF_BOUNDS,
@@ -69,7 +70,8 @@ WASM_API_EXTERN wasm_trap_t *wasmtime_trap_new(const char *msg, size_t msg_len);
  * an instruction trap -- traps can also be created using wasm_trap_new,
  * or occur with WASI modules exiting with a certain exit code.
  */
-WASM_API_EXTERN bool wasmtime_trap_code(const wasm_trap_t*, wasmtime_trap_code_t *code);
+WASM_API_EXTERN bool wasmtime_trap_code(const wasm_trap_t *,
+                                        wasmtime_trap_code_t *code);
 
 /**
  * \brief Returns a human-readable name for this frame's function.
@@ -79,7 +81,8 @@ WASM_API_EXTERN bool wasmtime_trap_code(const wasm_trap_t*, wasmtime_trap_code_t
  *
  * The lifetime of the returned name is the same as the #wasm_frame_t itself.
  */
-WASM_API_EXTERN const wasm_name_t *wasmtime_frame_func_name(const wasm_frame_t*);
+WASM_API_EXTERN const wasm_name_t *
+wasmtime_frame_func_name(const wasm_frame_t *);
 
 /**
  * \brief Returns a human-readable name for this frame's module.
@@ -89,11 +92,11 @@ WASM_API_EXTERN const wasm_name_t *wasmtime_frame_func_name(const wasm_frame_t*)
  *
  * The lifetime of the returned name is the same as the #wasm_frame_t itself.
  */
-WASM_API_EXTERN const wasm_name_t *wasmtime_frame_module_name(const wasm_frame_t*);
-
+WASM_API_EXTERN const wasm_name_t *
+wasmtime_frame_module_name(const wasm_frame_t *);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_TRAP_H
diff --git a/crates/c-api/include/wasmtime/val.h b/crates/c-api/include/wasmtime/val.h
index 4c4081336..61c82873b 100644
--- a/crates/c-api/include/wasmtime/val.h
+++ b/crates/c-api/include/wasmtime/val.h
@@ -41,7 +41,8 @@ typedef struct wasmtime_externref wasmtime_externref_t;
  *
  * The returned value must be deleted with #wasmtime_externref_delete
  */
-WASM_API_EXTERN wasmtime_externref_t *wasmtime_externref_new(void *data, void (*finalizer)(void*));
+WASM_API_EXTERN wasmtime_externref_t *
+wasmtime_externref_new(void *data, void (*finalizer)(void *));
 
 /**
  * \brief Get an `externref`'s wrapped data
@@ -55,7 +56,8 @@ WASM_API_EXTERN void *wasmtime_externref_data(wasmtime_externref_t *data);
  * \brief Creates a shallow copy of the `externref` argument, returning a
  * separately owned pointer (increases the reference count).
  */
-WASM_API_EXTERN wasmtime_externref_t *wasmtime_externref_clone(wasmtime_externref_t *ref);
+WASM_API_EXTERN wasmtime_externref_t *
+wasmtime_externref_clone(wasmtime_externref_t *ref);
 
 /**
  * \brief Decrements the reference count of the `ref`, deleting it if it's the
@@ -70,7 +72,8 @@ WASM_API_EXTERN void wasmtime_externref_delete(wasmtime_externref_t *ref);
  * Note that the returned #wasmtime_externref_t is an owned value that must be
  * deleted via #wasmtime_externref_delete by the caller if it is non-null.
  */
-WASM_API_EXTERN wasmtime_externref_t *wasmtime_externref_from_raw(wasmtime_context_t *context, void *raw);
+WASM_API_EXTERN wasmtime_externref_t *
+wasmtime_externref_from_raw(wasmtime_context_t *context, void *raw);
 
 /**
  * \brief Converts a #wasmtime_externref_t to a raw value suitable for storing
@@ -82,9 +85,9 @@ WASM_API_EXTERN wasmtime_externref_t *wasmtime_externref_from_raw(wasmtime_conte
  * context of the store. Do not perform a GC between calling this function and
  * passing it to WebAssembly.
  */
-WASM_API_EXTERN void *wasmtime_externref_to_raw(
-    wasmtime_context_t *context,
-    const wasmtime_externref_t *ref);
+WASM_API_EXTERN void *
+wasmtime_externref_to_raw(wasmtime_context_t *context,
+                          const wasmtime_externref_t *ref);
 
 /// \brief Discriminant stored in #wasmtime_val::kind
 typedef uint8_t wasmtime_valkind_t;
@@ -98,9 +101,11 @@ typedef uint8_t wasmtime_valkind_t;
 #define WASMTIME_F64 3
 /// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is a v128
 #define WASMTIME_V128 4
-/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is a funcref
+/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is a
+/// funcref
 #define WASMTIME_FUNCREF 5
-/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is an externref
+/// \brief Value of #wasmtime_valkind_t meaning that #wasmtime_val_t is an
+/// externref
 #define WASMTIME_EXTERNREF 6
 
 /// \brief A 128-bit value representing the WebAssembly `v128` type. Bytes are
@@ -222,11 +227,11 @@ WASM_API_EXTERN void wasmtime_val_delete(wasmtime_val_t *val);
 /**
  * \brief Copies `src` into `dst`.
  */
-WASM_API_EXTERN void wasmtime_val_copy(wasmtime_val_t *dst, const wasmtime_val_t *src);
+WASM_API_EXTERN void wasmtime_val_copy(wasmtime_val_t *dst,
+                                       const wasmtime_val_t *src);
 
 #ifdef __cplusplus
-}  // extern "C"
+} // extern "C"
 #endif
 
 #endif // WASMTIME_VAL_H
-
diff --git a/crates/fiber/src/windows.c b/crates/fiber/src/windows.c
index 9d4176eb1..bd7c083db 100644
--- a/crates/fiber/src/windows.c
+++ b/crates/fiber/src/windows.c
@@ -1,9 +1,9 @@
 #include <windows.h>
 
-#define CONCAT2(a, b) a ## b
-#define CONCAT(a, b) CONCAT2(a , b)
+#define CONCAT2(a, b) a##b
+#define CONCAT(a, b) CONCAT2(a, b)
 #define VERSIONED_SYMBOL(a) CONCAT(a, VERSIONED_SUFFIX)
 
 LPVOID VERSIONED_SYMBOL(wasmtime_fiber_get_current)() {
-   return GetCurrentFiber();
+  return GetCurrentFiber();
 }
diff --git a/crates/runtime/src/helpers.c b/crates/runtime/src/helpers.c
index 3b8256bed..08fcfeb75 100644
--- a/crates/runtime/src/helpers.c
+++ b/crates/runtime/src/helpers.c
@@ -15,6 +15,8 @@ typedef jmp_buf platform_jmp_buf;
 
 #elif defined(WASMTIME_GCC) || defined(__x86_64__)
 
+// clang-format off
+
 // GCC and Clang on x86_64 provide `__builtin_setjmp`/`__builtin_longjmp`, which
 // differ from plain `setjmp` and `longjmp` in that they're implemented by
 // the compiler inline rather than in libc, and the compiler can avoid saving
@@ -28,9 +30,12 @@ typedef jmp_buf platform_jmp_buf;
 //
 // [GCC docs]: https://gcc.gnu.org/onlinedocs/gcc/Nonlocal-Gotos.html
 // [clang docs]: https://llvm.org/docs/ExceptionHandling.html#llvm-eh-sjlj-setjmp
+
+// clang-format on
 #define platform_setjmp(buf) __builtin_setjmp(buf)
 #define platform_longjmp(buf, arg) __builtin_longjmp(buf, arg)
-typedef void *platform_jmp_buf[5]; // this is the documented size; see the docs links for details.
+typedef void *platform_jmp_buf[5]; // this is the documented size; see the docs
+                                   // links for details.
 
 #else
 
@@ -46,15 +51,13 @@ typedef sigjmp_buf platform_jmp_buf;
 
 #endif
 
-#define CONCAT2(a, b) a ## b
-#define CONCAT(a, b) CONCAT2(a , b)
+#define CONCAT2(a, b) a##b
+#define CONCAT(a, b) CONCAT2(a, b)
 #define VERSIONED_SYMBOL(a) CONCAT(a, VERSIONED_SUFFIX)
 
-int VERSIONED_SYMBOL(wasmtime_setjmp)(
-    void **buf_storage,
-    void (*body)(void*, void*),
-    void *payload,
-    void *callee) {
+int VERSIONED_SYMBOL(wasmtime_setjmp)(void **buf_storage,
+                                      void (*body)(void *, void *),
+                                      void *payload, void *callee) {
   platform_jmp_buf buf;
   if (platform_setjmp(buf) != 0) {
     return 0;
@@ -65,23 +68,23 @@ int VERSIONED_SYMBOL(wasmtime_setjmp)(
 }
 
 void VERSIONED_SYMBOL(wasmtime_longjmp)(void *JmpBuf) {
-  platform_jmp_buf *buf = (platform_jmp_buf*) JmpBuf;
+  platform_jmp_buf *buf = (platform_jmp_buf *)JmpBuf;
   platform_longjmp(*buf, 1);
 }
 
 #ifdef CFG_TARGET_OS_windows
-  // export required for external access.
+// export required for external access.
 __declspec(dllexport)
 #else
-  // Note the `weak` linkage here, though, which is intended to let other code
-  // override this symbol if it's defined elsewhere, since this definition doesn't
-  // matter.
-  // Just in case cross-language LTO is enabled we set the `noinline` attribute
-  // and also try to have some sort of side effect in this function with a dummy
-  // `asm` statement.
+// Note the `weak` linkage here, though, which is intended to let other code
+// override this symbol if it's defined elsewhere, since this definition doesn't
+// matter.
+// Just in case cross-language LTO is enabled we set the `noinline` attribute
+// and also try to have some sort of side effect in this function with a dummy
+// `asm` statement.
 __attribute__((weak, noinline))
 #endif
-void __jit_debug_register_code() {
+    void __jit_debug_register_code() {
 #ifndef CFG_TARGET_OS_windows
   __asm__("");
 #endif
@@ -90,23 +93,21 @@ void __jit_debug_register_code() {
 struct JITDescriptor {
   uint32_t version_;
   uint32_t action_flag_;
-  void* relevant_entry_;
-  void* first_entry_;
+  void *relevant_entry_;
+  void *first_entry_;
 };
 
 #ifdef CFG_TARGET_OS_windows
-  // export required for external access.
-  __declspec(dllexport)
+// export required for external access.
+__declspec(dllexport)
 #else
-  // Note the `weak` linkage here which is the same purpose as above. We want to
-  // let other runtimes be able to override this since our own definition isn't
-  // important.
-  __attribute__((weak))
+// Note the `weak` linkage here which is the same purpose as above. We want to
+// let other runtimes be able to override this since our own definition isn't
+// important.
+__attribute__((weak))
 #endif
-struct JITDescriptor __jit_debug_descriptor = {1, 0, NULL, NULL};
-
-
+    struct JITDescriptor __jit_debug_descriptor = {1, 0, NULL, NULL};
 
-struct JITDescriptor* VERSIONED_SYMBOL(wasmtime_jit_debug_descriptor)() {
+struct JITDescriptor *VERSIONED_SYMBOL(wasmtime_jit_debug_descriptor)() {
   return &__jit_debug_descriptor;
 }
diff --git a/crates/wasi-http/src/body.rs b/crates/wasi-http/src/body.rs
index 41f730286..4906bcf48 100644
--- a/crates/wasi-http/src/body.rs
+++ b/crates/wasi-http/src/body.rs
@@ -300,6 +300,9 @@ pub enum HostFutureTrailers {
     /// Note that `Ok(None)` means that there were no trailers for this request
     /// while `Ok(Some(_))` means that trailers were found in the request.
     Done(Result<Option<FieldMap>, types::ErrorCode>),
+
+    /// Trailers have been consumed by `future-trailers.get`.
+    Consumed,
 }
 
 #[async_trait::async_trait]
@@ -308,6 +311,7 @@ impl Subscribe for HostFutureTrailers {
         let body = match self {
             HostFutureTrailers::Waiting(body) => body,
             HostFutureTrailers::Done(_) => return,
+            HostFutureTrailers::Consumed => return,
         };
 
         // If the body is itself being read by a body stream then we need to
@@ -337,6 +341,7 @@ impl Subscribe for HostFutureTrailers {
         let body = match self {
             HostFutureTrailers::Waiting(body) => body,
             HostFutureTrailers::Done(_) => return,
+            HostFutureTrailers::Consumed => return,
         };
         let hyper_body = match &mut body.body {
             IncomingBodyState::Start(body) => body,
diff --git a/crates/wasi-http/src/types_impl.rs b/crates/wasi-http/src/types_impl.rs
index 2858be3dc..718a26588 100644
--- a/crates/wasi-http/src/types_impl.rs
+++ b/crates/wasi-http/src/types_impl.rs
@@ -637,32 +637,31 @@ impl<T: WasiHttpView> crate::bindings::http::types::HostFutureTrailers for T {
     fn get(
         &mut self,
         id: Resource<HostFutureTrailers>,
-    ) -> wasmtime::Result<Option<Result<Option<Resource<Trailers>>, types::ErrorCode>>> {
+    ) -> wasmtime::Result<Option<Result<Result<Option<Resource<Trailers>>, types::ErrorCode>, ()>>>
+    {
         let trailers = self.table().get_mut(&id)?;
         match trailers {
             HostFutureTrailers::Waiting(_) => return Ok(None),
-            HostFutureTrailers::Done(Err(e)) => return Ok(Some(Err(e.clone()))),
-            HostFutureTrailers::Done(Ok(None)) => return Ok(Some(Ok(None))),
-            HostFutureTrailers::Done(Ok(_)) => {}
-        }
+            HostFutureTrailers::Consumed => return Ok(Some(Err(()))),
+            HostFutureTrailers::Done(_) => {}
+        };
 
-        fn get_fields(elem: &mut dyn Any) -> &mut FieldMap {
-            let trailers = elem.downcast_mut::<HostFutureTrailers>().unwrap();
-            match trailers {
-                HostFutureTrailers::Done(Ok(Some(e))) => e,
-                _ => unreachable!(),
-            }
-        }
+        let res = match std::mem::replace(trailers, HostFutureTrailers::Consumed) {
+            HostFutureTrailers::Done(res) => res,
+            _ => unreachable!(),
+        };
 
-        let hdrs = self.table().push_child(
-            HostFields::Ref {
-                parent: id.rep(),
-                get_fields,
-            },
-            &id,
-        )?;
+        let mut fields = match res {
+            Ok(Some(fields)) => fields,
+            Ok(None) => return Ok(Some(Ok(Ok(None)))),
+            Err(e) => return Ok(Some(Ok(Err(e)))),
+        };
+
+        remove_forbidden_headers(self, &mut fields);
+
+        let ts = self.table().push(HostFields::Owned { fields })?;
 
-        Ok(Some(Ok(Some(hdrs))))
+        Ok(Some(Ok(Ok(Some(ts)))))
     }
 }
 
@@ -886,84 +885,84 @@ impl<T: WasiHttpView> crate::bindings::http::types::HostRequestOptions for T {
         Ok(id)
     }
 
-    fn connect_timeout_ms(
+    fn connect_timeout(
         &mut self,
         opts: Resource<types::RequestOptions>,
     ) -> wasmtime::Result<Option<types::Duration>> {
-        let millis = self
+        let nanos = self
             .table()
             .get(&opts)?
             .connect_timeout
-            .map(|d| d.as_millis());
+            .map(|d| d.as_nanos());
 
-        if let Some(millis) = millis {
-            Ok(Some(millis.try_into()?))
+        if let Some(nanos) = nanos {
+            Ok(Some(nanos.try_into()?))
         } else {
             Ok(None)
         }
     }
 
-    fn set_connect_timeout_ms(
+    fn set_connect_timeout(
         &mut self,
         opts: Resource<types::RequestOptions>,
-        ms: Option<types::Duration>,
+        duration: Option<types::Duration>,
     ) -> wasmtime::Result<Result<(), ()>> {
         self.table().get_mut(&opts)?.connect_timeout =
-            ms.map(|ms| std::time::Duration::from_millis(ms));
+            duration.map(std::time::Duration::from_nanos);
         Ok(Ok(()))
     }
 
-    fn first_byte_timeout_ms(
+    fn first_byte_timeout(
         &mut self,
         opts: Resource<types::RequestOptions>,
     ) -> wasmtime::Result<Option<types::Duration>> {
-        let millis = self
+        let nanos = self
             .table()
             .get(&opts)?
             .first_byte_timeout
-            .map(|d| d.as_millis());
+            .map(|d| d.as_nanos());
 
-        if let Some(millis) = millis {
-            Ok(Some(millis.try_into()?))
+        if let Some(nanos) = nanos {
+            Ok(Some(nanos.try_into()?))
         } else {
             Ok(None)
         }
     }
 
-    fn set_first_byte_timeout_ms(
+    fn set_first_byte_timeout(
         &mut self,
         opts: Resource<types::RequestOptions>,
-        ms: Option<types::Duration>,
+        duration: Option<types::Duration>,
     ) -> wasmtime::Result<Result<(), ()>> {
         self.table().get_mut(&opts)?.first_byte_timeout =
-            ms.map(|ms| std::time::Duration::from_millis(ms));
+            duration.map(std::time::Duration::from_nanos);
         Ok(Ok(()))
     }
 
-    fn between_bytes_timeout_ms(
+    fn between_bytes_timeout(
         &mut self,
         opts: Resource<types::RequestOptions>,
     ) -> wasmtime::Result<Option<types::Duration>> {
-        let millis = self
+        let nanos = self
             .table()
             .get(&opts)?
             .between_bytes_timeout
-            .map(|d| d.as_millis());
+            .map(|d| d.as_nanos());
 
-        if let Some(millis) = millis {
-            Ok(Some(millis.try_into()?))
+        if let Some(nanos) = nanos {
+            Ok(Some(nanos.try_into()?))
         } else {
             Ok(None)
         }
     }
 
-    fn set_between_bytes_timeout_ms(
+    fn set_between_bytes_timeout(
         &mut self,
         opts: Resource<types::RequestOptions>,
-        ms: Option<types::Duration>,
+        duration: Option<types::Duration>,
     ) -> wasmtime::Result<Result<(), ()>> {
         self.table().get_mut(&opts)?.between_bytes_timeout =
-            ms.map(|ms| std::time::Duration::from_millis(ms));
+            duration.map(std::time::Duration::from_nanos);
         Ok(Ok(()))
     }
 
diff --git a/crates/wasi-http/wit/deps/http/types.wit b/crates/wasi-http/wit/deps/http/types.wit
index 1dd4214cd..c42f841bf 100644
--- a/crates/wasi-http/wit/deps/http/types.wit
+++ b/crates/wasi-http/wit/deps/http/types.wit
@@ -309,8 +309,7 @@ interface types {
   }
 
   /// Parameters for making an HTTP Request. Each of these parameters is an
-  /// optional timeout, with the unit in milliseconds, applicable to the
-  /// transport layer of the HTTP protocol.
+  /// optional timeout, applicable to the transport layer of the HTTP protocol.
   ///
   /// These timeouts are separate from any the user may use to bound a
   /// blocking call to `wasi:io/poll.poll`.
@@ -319,27 +318,27 @@ interface types {
     constructor();
 
     /// The timeout for the initial connect to the HTTP Server.
-    connect-timeout-ms: func() -> option<duration>;
+    connect-timeout: func() -> option<duration>;
 
     /// Set the timeout for the initial connect to the HTTP Server. An error
     /// return value indicates that this timeout is not supported.
-    set-connect-timeout-ms: func(ms: option<duration>) -> result;
+    set-connect-timeout: func(duration: option<duration>) -> result;
 
     /// The timeout for receiving the first byte of the Response body.
-    first-byte-timeout-ms: func() -> option<duration>;
+    first-byte-timeout: func() -> option<duration>;
 
     /// Set the timeout for receiving the first byte of the Response body. An
     /// error return value indicates that this timeout is not supported.
-    set-first-byte-timeout-ms: func(ms: option<duration>) -> result;
+    set-first-byte-timeout: func(duration: option<duration>) -> result;
 
     /// The timeout for receiving subsequent chunks of bytes in the Response
     /// body stream.
-    between-bytes-timeout-ms: func() -> option<duration>;
+    between-bytes-timeout: func() -> option<duration>;
 
     /// Set the timeout for receiving subsequent chunks of bytes in the Response
     /// body stream. An error return value indicates that this timeout is not
     /// supported.
-    set-between-bytes-timeout-ms: func(ms: option<duration>) -> result;
+    set-between-bytes-timeout: func(duration: option<duration>) -> result;
   }
 
   /// Represents the ability to send an HTTP Response.
@@ -437,16 +436,20 @@ interface types {
     /// The outer `option` represents future readiness. Users can wait on this
     /// `option` to become `some` using the `subscribe` method.
     ///
-    /// The `result` represents that either the HTTP Request or Response body,
-    /// as well as any trailers, were received successfully, or that an error
-    /// occured receiving them. The optional `trailers` indicates whether or not
-    /// trailers were present in the body.
+    /// The outer `result` is used to retrieve the trailers or error at most
+    /// once. It will be success on the first call in which the outer option
+    /// is `some`, and error on subsequent calls.
+    ///
+    /// The inner `result` represents that either the HTTP Request or Response
+    /// body, as well as any trailers, were received successfully, or that an
+    /// error occured receiving them. The optional `trailers` indicates whether
+    /// or not trailers were present in the body.
     ///
     /// When some `trailers` are returned by this method, the `trailers`
     /// resource is immutable, and a child. Use of the `set`, `append`, or
     /// `delete` methods will return an error, and the resource must be
     /// dropped before the parent `future-trailers` is dropped.
-    get: func() -> option<result<option<trailers>, error-code>>;
+    get: func() -> option<result<result<option<trailers>, error-code>>>;
   }
 
   /// Represents an outgoing HTTP Response.
diff --git a/crates/wasi/src/preview2/table.rs b/crates/wasi/src/preview2/table.rs
index 444e7b25f..9e60cd88d 100644
--- a/crates/wasi/src/preview2/table.rs
+++ b/crates/wasi/src/preview2/table.rs
@@ -23,8 +23,30 @@ pub enum TableError {
 /// up. Right now it is just an approximation.
 #[derive(Debug)]
 pub struct Table {
-    map: HashMap<u32, TableEntry>,
-    next_key: u32,
+    entries: Vec<Entry>,
+    free_head: Option<usize>,
+}
+
+#[derive(Debug)]
+enum Entry {
+    Free { next: Option<usize> },
+    Occupied { entry: TableEntry },
+}
+
+impl Entry {
+    pub fn occupied(&self) -> Option<&TableEntry> {
+        match self {
+            Self::Occupied { entry } => Some(entry),
+            Self::Free { .. } => None,
+        }
+    }
+
+    pub fn occupied_mut(&mut self) -> Option<&mut TableEntry> {
+        match self {
+            Self::Occupied { entry } => Some(entry),
+            Self::Free { .. } => None,
+        }
+    }
 }
 
 /// This structure tracks parent and child relationships for a given table entry.
@@ -68,12 +90,16 @@ impl Table {
     /// Create an empty table
     pub fn new() -> Self {
         Table {
-            map: HashMap::new(),
-            // 0, 1 and 2 are formerly (preview 1) for stdio. To prevent users from assuming these
-            // indicies are still valid ways to access stdio, they are deliberately left empty.
-            // Once we have a full implementation of resources, this confusion should hopefully be
-            // impossible :)
-            next_key: 3,
+            entries: Vec::new(),
+            free_head: None,
+        }
+    }
+
+    /// Create an empty table with at least the specified capacity.
+    pub fn with_capacity(capacity: usize) -> Self {
+        Table {
+            entries: Vec::with_capacity(capacity),
+            free_head: None,
         }
     }
 
@@ -87,23 +113,68 @@ impl Table {
         Ok(Resource::new_own(idx))
     }
 
-    fn push_(&mut self, e: TableEntry) -> Result<u32, TableError> {
-        // NOTE: The performance of this new key calculation could be very bad once keys wrap
-        // around.
-        if self.map.len() == u32::MAX as usize {
-            return Err(TableError::Full);
-        }
-        loop {
-            let key = self.next_key;
-            self.next_key = self.next_key.wrapping_add(1);
-            if self.map.contains_key(&key) {
-                continue;
+    /// Pop an index off of the free list, if it's not empty.
+    fn pop_free_list(&mut self) -> Option<usize> {
+        if let Some(ix) = self.free_head {
+            // Advance free_head to the next entry if one is available.
+            match &self.entries[ix] {
+                Entry::Free { next } => self.free_head = *next,
+                Entry::Occupied { .. } => unreachable!(),
             }
-            self.map.insert(key, e);
-            return Ok(key);
+            Some(ix)
+        } else {
+            None
+        }
+    }
+
+    /// Free an entry in the table, returning its [`TableEntry`]. Add the index to the free list.
+    fn free_entry(&mut self, ix: usize) -> TableEntry {
+        let entry = match std::mem::replace(
+            &mut self.entries[ix],
+            Entry::Free {
+                next: self.free_head,
+            },
+        ) {
+            Entry::Occupied { entry } => entry,
+            Entry::Free { .. } => unreachable!(),
+        };
+
+        self.free_head = Some(ix);
+
+        entry
+    }
+
+    /// Push a new entry into the table, returning its handle. This will prefer to use free entries
+    /// if they exist, falling back on pushing new entries onto the end of the table.
+    fn push_(&mut self, e: TableEntry) -> Result<u32, TableError> {
+        if let Some(free) = self.pop_free_list() {
+            self.entries[free] = Entry::Occupied { entry: e };
+            Ok(free as u32)
+        } else {
+            let ix = self
+                .entries
+                .len()
+                .try_into()
+                .map_err(|_| TableError::Full)?;
+            self.entries.push(Entry::Occupied { entry: e });
+            Ok(ix)
         }
     }
 
+    fn occupied(&self, key: u32) -> Result<&TableEntry, TableError> {
+        self.entries
+            .get(key as usize)
+            .and_then(Entry::occupied)
+            .ok_or(TableError::NotPresent)
+    }
+
+    fn occupied_mut(&mut self, key: u32) -> Result<&mut TableEntry, TableError> {
+        self.entries
+            .get_mut(key as usize)
+            .and_then(Entry::occupied_mut)
+            .ok_or(TableError::NotPresent)
+    }
+
     /// Insert a resource at the next available index, and track that it has a
     /// parent resource.
     ///
@@ -131,24 +202,11 @@ impl Table {
         T: Send + Sync + 'static,
         U: 'static,
     {
-        let idx = self.push_child_(Box::new(entry), parent.rep())?;
-        Ok(Resource::new_own(idx))
-    }
-
-    fn push_child_(
-        &mut self,
-        entry: Box<dyn Any + Send + Sync>,
-        parent: u32,
-    ) -> Result<u32, TableError> {
-        if !self.map.contains_key(&parent) {
-            return Err(TableError::NotPresent);
-        }
-        let child = self.push_(TableEntry::new(entry, Some(parent)))?;
-        self.map
-            .get_mut(&parent)
-            .expect("parent existence assured above")
-            .add_child(child);
-        Ok(child)
+        let parent = parent.rep();
+        self.occupied(parent)?;
+        let child = self.push_(TableEntry::new(Box::new(entry), Some(parent)))?;
+        self.occupied_mut(parent)?.add_child(child);
+        Ok(Resource::new_own(child))
     }
 
     /// Get an immutable reference to a resource of a given type at a given
@@ -162,7 +220,7 @@ impl Table {
     }
 
     fn get_(&self, key: u32) -> Result<&dyn Any, TableError> {
-        let r = self.map.get(&key).ok_or(TableError::NotPresent)?;
+        let r = self.occupied(key)?;
         Ok(&*r.entry)
     }
 
@@ -176,7 +234,7 @@ impl Table {
 
     /// Returns the raw `Any` at the `key` index provided.
     pub fn get_any_mut(&mut self, key: u32) -> Result<&mut dyn Any, TableError> {
-        let r = self.map.get_mut(&key).ok_or(TableError::NotPresent)?;
+        let r = self.occupied_mut(key)?;
         Ok(&mut *r.entry)
     }
 
@@ -194,22 +252,15 @@ impl Table {
     }
 
     fn delete_entry(&mut self, key: u32) -> Result<TableEntry, TableError> {
-        if !self
-            .map
-            .get(&key)
-            .ok_or(TableError::NotPresent)?
-            .children
-            .is_empty()
-        {
+        if !self.occupied(key)?.children.is_empty() {
             return Err(TableError::HasChildren);
         }
-        let e = self.map.remove(&key).unwrap();
+        let e = self.free_entry(key as usize);
         if let Some(parent) = e.parent {
             // Remove deleted resource from parent's child list.
             // Parent must still be present because it cant be deleted while still having
             // children:
-            self.map
-                .get_mut(&parent)
+            self.occupied_mut(parent)
                 .expect("missing parent")
                 .remove_child(key);
         }
@@ -225,12 +276,10 @@ impl Table {
     ) -> impl Iterator<Item = (Result<&'a mut dyn Any, TableError>, T)> {
         map.into_iter().map(move |(k, v)| {
             let item = self
-                .map
-                .get_mut(&k)
+                .occupied_mut(k)
                 .map(|e| Box::as_mut(&mut e.entry))
                 // Safety: extending the lifetime of the mutable reference.
-                .map(|item| unsafe { &mut *(item as *mut dyn Any) })
-                .ok_or(TableError::NotPresent);
+                .map(|item| unsafe { &mut *(item as *mut dyn Any) });
             (item, v)
         })
     }
@@ -243,9 +292,9 @@ impl Table {
     where
         T: 'static,
     {
-        let parent_entry = self.map.get(&parent.rep()).ok_or(TableError::NotPresent)?;
+        let parent_entry = self.occupied(parent.rep())?;
         Ok(parent_entry.children.iter().map(|child_index| {
-            let child = self.map.get(child_index).expect("missing child");
+            let child = self.occupied(*child_index).expect("missing child");
             child.entry.as_ref()
         }))
     }
@@ -256,3 +305,33 @@ impl Default for Table {
         Table::new()
     }
 }
+
+#[test]
+pub fn test_free_list() {
+    let mut table = Table::new();
+
+    let x = table.push(()).unwrap();
+    assert_eq!(x.rep(), 0);
+
+    let y = table.push(()).unwrap();
+    assert_eq!(y.rep(), 1);
+
+    // Deleting x should put it on the free list, so the next entry should have the same rep.
+    table.delete(x).unwrap();
+    let x = table.push(()).unwrap();
+    assert_eq!(x.rep(), 0);
+
+    // Deleting x and then y should yield indices 1 and then 0 for new entries.
+    table.delete(x).unwrap();
+    table.delete(y).unwrap();
+
+    let y = table.push(()).unwrap();
+    assert_eq!(y.rep(), 1);
+
+    let x = table.push(()).unwrap();
+    assert_eq!(x.rep(), 0);
+
+    // As the free list is empty, this entry will have a new id.
+    let x = table.push(()).unwrap();
+    assert_eq!(x.rep(), 2);
+}
diff --git a/crates/wasi/wit/deps/http/types.wit b/crates/wasi/wit/deps/http/types.wit
index 1dd4214cd..c42f841bf 100644
--- a/crates/wasi/wit/deps/http/types.wit
+++ b/crates/wasi/wit/deps/http/types.wit
@@ -309,8 +309,7 @@ interface types {
   }
 
   /// Parameters for making an HTTP Request. Each of these parameters is an
-  /// optional timeout, with the unit in milliseconds, applicable to the
-  /// transport layer of the HTTP protocol.
+  /// optional timeout, applicable to the transport layer of the HTTP protocol.
   ///
   /// These timeouts are separate from any the user may use to bound a
   /// blocking call to `wasi:io/poll.poll`.
@@ -319,27 +318,27 @@ interface types {
     constructor();
 
     /// The timeout for the initial connect to the HTTP Server.
-    connect-timeout-ms: func() -> option<duration>;
+    connect-timeout: func() -> option<duration>;
 
     /// Set the timeout for the initial connect to the HTTP Server. An error
     /// return value indicates that this timeout is not supported.
-    set-connect-timeout-ms: func(ms: option<duration>) -> result;
+    set-connect-timeout: func(duration: option<duration>) -> result;
 
     /// The timeout for receiving the first byte of the Response body.
-    first-byte-timeout-ms: func() -> option<duration>;
+    first-byte-timeout: func() -> option<duration>;
 
     /// Set the timeout for receiving the first byte of the Response body. An
     /// error return value indicates that this timeout is not supported.
-    set-first-byte-timeout-ms: func(ms: option<duration>) -> result;
+    set-first-byte-timeout: func(duration: option<duration>) -> result;
 
     /// The timeout for receiving subsequent chunks of bytes in the Response
     /// body stream.
-    between-bytes-timeout-ms: func() -> option<duration>;
+    between-bytes-timeout: func() -> option<duration>;
 
     /// Set the timeout for receiving subsequent chunks of bytes in the Response
     /// body stream. An error return value indicates that this timeout is not
     /// supported.
-    set-between-bytes-timeout-ms: func(ms: option<duration>) -> result;
+    set-between-bytes-timeout: func(duration: option<duration>) -> result;
   }
 
   /// Represents the ability to send an HTTP Response.
@@ -437,16 +436,20 @@ interface types {
     /// The outer `option` represents future readiness. Users can wait on this
     /// `option` to become `some` using the `subscribe` method.
     ///
-    /// The `result` represents that either the HTTP Request or Response body,
-    /// as well as any trailers, were received successfully, or that an error
-    /// occured receiving them. The optional `trailers` indicates whether or not
-    /// trailers were present in the body.
+    /// The outer `result` is used to retrieve the trailers or error at most
+    /// once. It will be success on the first call in which the outer option
+    /// is `some`, and error on subsequent calls.
+    ///
+    /// The inner `result` represents that either the HTTP Request or Response
+    /// body, as well as any trailers, were received successfully, or that an
+    /// error occured receiving them. The optional `trailers` indicates whether
+    /// or not trailers were present in the body.
     ///
     /// When some `trailers` are returned by this method, the `trailers`
     /// resource is immutable, and a child. Use of the `set`, `append`, or
     /// `delete` methods will return an error, and the resource must be
     /// dropped before the parent `future-trailers` is dropped.
-    get: func() -> option<result<option<trailers>, error-code>>;
+    get: func() -> option<result<result<option<trailers>, error-code>>>;
   }
 
   /// Represents an outgoing HTTP Response.
diff --git a/examples/externref.c b/examples/externref.c
index b0107c8db..56b2a6f41 100644
--- a/examples/externref.c
+++ b/examples/externref.c
@@ -18,7 +18,8 @@ to tweak the `-lpthread` and such annotations as well as the name of the
 
 You can also build using cmake:
 
-mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-externref
+mkdir build && cd build && cmake .. && \
+  cmake --build . --target wasmtime-externref
 */
 
 #include <assert.h>
@@ -28,7 +29,8 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-externr
 #include <wasm.h>
 #include <wasmtime.h>
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 int main() {
   int ret = 0;
@@ -51,7 +53,7 @@ int main() {
   wasmtime_context_t *context = wasmtime_store_context(store);
 
   // Read our input file, which in this case is a wasm text file.
-  FILE* file = fopen("examples/externref.wat", "r");
+  FILE *file = fopen("examples/externref.wat", "r");
   assert(file != NULL);
   fseek(file, 0L, SEEK_END);
   size_t file_size = ftell(file);
@@ -71,7 +73,7 @@ int main() {
   // Now that we've got our binary webassembly we can compile our module.
   printf("Compiling module...\n");
   wasmtime_module_t *module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) wasm.data, wasm.size, &module);
+  error = wasmtime_module_new(engine, (uint8_t *)wasm.data, wasm.size, &module);
   wasm_byte_vec_delete(&wasm);
   if (error != NULL)
     exit_with_error("failed to compile module", error, NULL);
@@ -90,18 +92,20 @@ int main() {
   //
   // Note that the NULL here is a finalizer callback, but we don't need one for
   // this example.
-  wasmtime_externref_t *externref = wasmtime_externref_new("Hello, World!", NULL);
+  wasmtime_externref_t *externref =
+      wasmtime_externref_new("Hello, World!", NULL);
 
   // The `externref`'s wrapped data should be the string "Hello, World!".
-  void* data = wasmtime_externref_data(externref);
-  assert(strcmp((char*)data, "Hello, World!") == 0);
+  void *data = wasmtime_externref_data(externref);
+  assert(strcmp((char *)data, "Hello, World!") == 0);
 
   printf("Touching `externref` table...\n");
 
   wasmtime_extern_t item;
 
   // Lookup the `table` export.
-  ok = wasmtime_instance_export_get(context, &instance, "table", strlen("table"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "table",
+                                    strlen("table"), &item);
   assert(ok);
   assert(item.kind == WASMTIME_EXTERN_TABLE);
 
@@ -118,13 +122,15 @@ int main() {
   ok = wasmtime_table_get(context, &item.of.table, 3, &elem);
   assert(ok);
   assert(elem.kind == WASMTIME_EXTERNREF);
-  assert(strcmp((char*)wasmtime_externref_data(elem.of.externref), "Hello, World!") == 0);
+  assert(strcmp((char *)wasmtime_externref_data(elem.of.externref),
+                "Hello, World!") == 0);
   wasmtime_val_delete(&elem);
 
   printf("Touching `externref` global...\n");
 
   // Lookup the `global` export.
-  ok = wasmtime_instance_export_get(context, &instance, "global", strlen("global"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "global",
+                                    strlen("global"), &item);
   assert(ok);
   assert(item.kind == WASMTIME_EXTERN_GLOBAL);
 
@@ -137,26 +143,30 @@ int main() {
   wasmtime_val_t global_val;
   wasmtime_global_get(context, &item.of.global, &global_val);
   assert(global_val.kind == WASMTIME_EXTERNREF);
-  assert(strcmp((char*)wasmtime_externref_data(elem.of.externref), "Hello, World!") == 0);
+  assert(strcmp((char *)wasmtime_externref_data(elem.of.externref),
+                "Hello, World!") == 0);
   wasmtime_val_delete(&global_val);
 
   printf("Calling `externref` func...\n");
 
   // Lookup the `func` export.
-  ok = wasmtime_instance_export_get(context, &instance, "func", strlen("func"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "func", strlen("func"),
+                                    &item);
   assert(ok);
   assert(item.kind == WASMTIME_EXTERN_FUNC);
 
   // And call it!
   wasmtime_val_t results[1];
-  error = wasmtime_func_call(context, &item.of.func, &externref_val, 1, results, 1, &trap);
+  error = wasmtime_func_call(context, &item.of.func, &externref_val, 1, results,
+                             1, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to call function", error, trap);
 
   // `func` returns the same reference we gave it, so `results[0]` should be our
   // `externref`.
   assert(results[0].kind == WASMTIME_EXTERNREF);
-  assert(strcmp((char*)wasmtime_externref_data(results[0].of.externref), "Hello, World!") == 0);
+  assert(strcmp((char *)wasmtime_externref_data(results[0].of.externref),
+                "Hello, World!") == 0);
   wasmtime_val_delete(&results[0]);
 
   // We can GC any now-unused references to our externref that the store is
@@ -174,7 +184,8 @@ int main() {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -184,7 +195,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/fib-debug/main.c b/examples/fib-debug/main.c
index 20f0b0acb..dee99461e 100644
--- a/examples/fib-debug/main.c
+++ b/examples/fib-debug/main.c
@@ -1,30 +1,31 @@
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
 #include <wasm.h>
 #include <wasmtime.h>
 
 #define own
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
-int main(int argc, const char* argv[]) {
+int main(int argc, const char *argv[]) {
   // Configuring engine to support generating of DWARF info.
   // lldb can be used to attach to the program and observe
   // original fib-wasm.c source code and variables.
-  wasm_config_t* config = wasm_config_new();
+  wasm_config_t *config = wasm_config_new();
   wasmtime_config_debug_info_set(config, true);
 
   // Initialize.
   printf("Initializing...\n");
-  wasm_engine_t* engine = wasm_engine_new_with_config(config);
-  wasmtime_store_t* store = wasmtime_store_new(engine, NULL, NULL);
-  wasmtime_context_t* context = wasmtime_store_context(store);
+  wasm_engine_t *engine = wasm_engine_new_with_config(config);
+  wasmtime_store_t *store = wasmtime_store_new(engine, NULL, NULL);
+  wasmtime_context_t *context = wasmtime_store_context(store);
 
   // Load binary.
   printf("Loading binary...\n");
-  FILE* file = fopen("target/wasm32-unknown-unknown/debug/fib.wasm", "rb");
+  FILE *file = fopen("target/wasm32-unknown-unknown/debug/fib.wasm", "rb");
   if (!file) {
     printf("> Error opening module!\n");
     return 1;
@@ -43,7 +44,8 @@ int main(int argc, const char* argv[]) {
   // Compile.
   printf("Compiling module...\n");
   wasmtime_module_t *module = NULL;
-  wasmtime_error_t* error = wasmtime_module_new(engine, (uint8_t*) binary.data, binary.size, &module);
+  wasmtime_error_t *error =
+      wasmtime_module_new(engine, (uint8_t *)binary.data, binary.size, &module);
   if (!module)
     exit_with_error("failed to compile module", error, NULL);
   wasm_byte_vec_delete(&binary);
@@ -68,7 +70,8 @@ int main(int argc, const char* argv[]) {
   params[0].kind = WASMTIME_I32;
   params[0].of.i32 = 6;
   wasmtime_val_t results[1];
-  error = wasmtime_func_call(context, &fib.of.func, params, 1, results, 1, &trap);
+  error =
+      wasmtime_func_call(context, &fib.of.func, params, 1, results, 1, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to call function", error, trap);
 
@@ -85,7 +88,8 @@ int main(int argc, const char* argv[]) {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -93,7 +97,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
   } else {
     wasm_trap_message(trap, &error_message);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/fuel.c b/examples/fuel.c
index 173bdcf58..945dc5bf5 100644
--- a/examples/fuel.c
+++ b/examples/fuel.c
@@ -27,7 +27,8 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-fuel
 #include <wasm.h>
 #include <wasmtime.h>
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 int main() {
   wasmtime_error_t *error = NULL;
@@ -36,7 +37,8 @@ int main() {
   assert(config != NULL);
   wasmtime_config_consume_fuel_set(config, true);
 
-  // Create an *engine*, which is a compilation context, with our configured options.
+  // Create an *engine*, which is a compilation context, with our configured
+  // options.
   wasm_engine_t *engine = wasm_engine_new_with_config(config);
   assert(engine != NULL);
   wasmtime_store_t *store = wasmtime_store_new(engine, NULL, NULL);
@@ -48,7 +50,7 @@ int main() {
     exit_with_error("failed to set fuel", error, NULL);
 
   // Load our input file to parse it next
-  FILE* file = fopen("examples/fuel.wat", "r");
+  FILE *file = fopen("examples/fuel.wat", "r");
   if (!file) {
     printf("> Error loading file!\n");
     return 1;
@@ -73,7 +75,7 @@ int main() {
 
   // Compile and instantiate our module
   wasmtime_module_t *module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) wasm.data, wasm.size, &module);
+  error = wasmtime_module_new(engine, (uint8_t *)wasm.data, wasm.size, &module);
   if (module == NULL)
     exit_with_error("failed to compile module", error, NULL);
   wasm_byte_vec_delete(&wasm);
@@ -86,19 +88,21 @@ int main() {
 
   // Lookup our `fibonacci` export function
   wasmtime_extern_t fib;
-  bool ok = wasmtime_instance_export_get(context, &instance, "fibonacci", strlen("fibonacci"), &fib);
+  bool ok = wasmtime_instance_export_get(context, &instance, "fibonacci",
+                                         strlen("fibonacci"), &fib);
   assert(ok);
   assert(fib.kind == WASMTIME_EXTERN_FUNC);
 
   // Call it repeatedly until it fails
-  for (int n = 1; ; n++) {
+  for (int n = 1;; n++) {
     uint64_t fuel_before;
     wasmtime_context_get_fuel(context, &fuel_before);
     wasmtime_val_t params[1];
     params[0].kind = WASMTIME_I32;
     params[0].of.i32 = n;
     wasmtime_val_t results[1];
-    error = wasmtime_func_call(context, &fib.of.func, params, 1, results, 1, &trap);
+    error =
+        wasmtime_func_call(context, &fib.of.func, params, 1, results, 1, &trap);
     if (error != NULL || trap != NULL) {
       if (trap != NULL) {
         wasmtime_trap_code_t code;
@@ -112,7 +116,8 @@ int main() {
     uint64_t fuel_after;
     wasmtime_context_get_fuel(context, &fuel_after);
     assert(results[0].kind == WASMTIME_I32);
-    printf("fib(%d) = %d [consumed %lu fuel]\n", n, results[0].of.i32, fuel_after - fuel_before);
+    printf("fib(%d) = %d [consumed %lu fuel]\n", n, results[0].of.i32,
+           fuel_after - fuel_before);
 
     error = wasmtime_context_set_fuel(context, 10000);
     if (error != NULL)
@@ -126,7 +131,8 @@ int main() {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -134,7 +140,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
   } else {
     wasm_trap_message(trap, &error_message);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/gcd.c b/examples/gcd.c
index cac7f6bb0..9f7f45c0a 100644
--- a/examples/gcd.c
+++ b/examples/gcd.c
@@ -27,7 +27,8 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-gcd
 #include <wasm.h>
 #include <wasmtime.h>
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 int main() {
   int ret = 0;
@@ -39,7 +40,7 @@ int main() {
   wasmtime_context_t *context = wasmtime_store_context(store);
 
   // Load our input file to parse it next
-  FILE* file = fopen("examples/gcd.wat", "r");
+  FILE *file = fopen("examples/gcd.wat", "r");
   if (!file) {
     printf("> Error loading file!\n");
     return 1;
@@ -64,7 +65,7 @@ int main() {
 
   // Compile and instantiate our module
   wasmtime_module_t *module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) wasm.data, wasm.size, &module);
+  error = wasmtime_module_new(engine, (uint8_t *)wasm.data, wasm.size, &module);
   if (module == NULL)
     exit_with_error("failed to compile module", error, NULL);
   wasm_byte_vec_delete(&wasm);
@@ -90,7 +91,8 @@ int main() {
   params[1].kind = WASMTIME_I32;
   params[1].of.i32 = b;
   wasmtime_val_t results[1];
-  error = wasmtime_func_call(context, &gcd.of.func, params, 2, results, 1, &trap);
+  error =
+      wasmtime_func_call(context, &gcd.of.func, params, 2, results, 1, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to call gcd", error, trap);
   assert(results[0].kind == WASMTIME_I32);
@@ -106,7 +108,8 @@ int main() {
   return ret;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -114,7 +117,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
   } else {
     wasm_trap_message(trap, &error_message);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/hello.c b/examples/hello.c
index 5adf97b9b..15fa6ea0a 100644
--- a/examples/hello.c
+++ b/examples/hello.c
@@ -28,16 +28,12 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-hello
 #include <wasm.h>
 #include <wasmtime.h>
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
-
-static wasm_trap_t* hello_callback(
-    void *env,
-    wasmtime_caller_t *caller,
-    const wasmtime_val_t *args,
-    size_t nargs,
-    wasmtime_val_t *results,
-    size_t nresults
-) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
+
+static wasm_trap_t *hello_callback(void *env, wasmtime_caller_t *caller,
+                                   const wasmtime_val_t *args, size_t nargs,
+                                   wasmtime_val_t *results, size_t nresults) {
   printf("Calling back...\n");
   printf("> Hello World!\n");
   return NULL;
@@ -60,7 +56,7 @@ int main() {
   wasmtime_context_t *context = wasmtime_store_context(store);
 
   // Read our input file, which in this case is a wasm text file.
-  FILE* file = fopen("examples/hello.wat", "r");
+  FILE *file = fopen("examples/hello.wat", "r");
   assert(file != NULL);
   fseek(file, 0L, SEEK_END);
   size_t file_size = ftell(file);
@@ -80,7 +76,7 @@ int main() {
   // Now that we've got our binary webassembly we can compile our module.
   printf("Compiling module...\n");
   wasmtime_module_t *module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) wasm.data, wasm.size, &module);
+  error = wasmtime_module_new(engine, (uint8_t *)wasm.data, wasm.size, &module);
   wasm_byte_vec_delete(&wasm);
   if (error != NULL)
     exit_with_error("failed to compile module", error, NULL);
@@ -131,7 +127,8 @@ int main() {
   return ret;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -141,7 +138,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/interrupt.c b/examples/interrupt.c
index 900bd2b64..201c15231 100644
--- a/examples/interrupt.c
+++ b/examples/interrupt.c
@@ -19,7 +19,8 @@ to tweak the `-lpthread` and such annotations as well as the name of the
 
 You can also build using cmake:
 
-mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-interrupt
+mkdir build && cd build && cmake .. && \
+  cmake --build . --target wasmtime-interrupt
 */
 
 #include <assert.h>
@@ -36,7 +37,7 @@ static void spawn_interrupt(wasm_engine_t *engine) {
 #include <pthread.h>
 #include <time.h>
 
-static void* helper(void *_engine) {
+static void *helper(void *_engine) {
   wasm_engine_t *engine = _engine;
   struct timespec sleep_dur;
   sleep_dur.tv_sec = 1;
@@ -54,7 +55,8 @@ static void spawn_interrupt(wasm_engine_t *engine) {
 }
 #endif
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 int main() {
   // Create a `wasm_store_t` with interrupts enabled
@@ -71,7 +73,7 @@ int main() {
   wasmtime_context_set_epoch_deadline(context, 1);
 
   // Read our input file, which in this case is a wasm text file.
-  FILE* file = fopen("examples/interrupt.wat", "r");
+  FILE *file = fopen("examples/interrupt.wat", "r");
   assert(file != NULL);
   fseek(file, 0L, SEEK_END);
   size_t file_size = ftell(file);
@@ -90,7 +92,7 @@ int main() {
 
   // Now that we've got our binary webassembly we can compile our module.
   wasmtime_module_t *module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) wasm.data, wasm.size, &module);
+  error = wasmtime_module_new(engine, (uint8_t *)wasm.data, wasm.size, &module);
   wasm_byte_vec_delete(&wasm);
   if (error != NULL)
     exit_with_error("failed to compile module", error, NULL);
@@ -123,7 +125,8 @@ int main() {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -133,7 +136,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/linking.c b/examples/linking.c
index b32d46890..d048451c2 100644
--- a/examples/linking.c
+++ b/examples/linking.c
@@ -24,14 +24,16 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-linking
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <wasm.h>
 #include <wasi.h>
+#include <wasm.h>
 #include <wasmtime.h>
 
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
-static void read_wat_file(wasm_engine_t *engine, wasm_byte_vec_t *bytes, const char *file);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
+static void read_wat_file(wasm_engine_t *engine, wasm_byte_vec_t *bytes,
+                          const char *file);
 
 int main() {
   // Set up our context
@@ -49,10 +51,12 @@ int main() {
   wasmtime_error_t *error;
   wasmtime_module_t *linking1_module = NULL;
   wasmtime_module_t *linking2_module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) linking1_wasm.data, linking1_wasm.size, &linking1_module);
+  error = wasmtime_module_new(engine, (uint8_t *)linking1_wasm.data,
+                              linking1_wasm.size, &linking1_module);
   if (error != NULL)
     exit_with_error("failed to compile linking1", error, NULL);
-  error = wasmtime_module_new(engine, (uint8_t*) linking2_wasm.data, linking2_wasm.size, &linking2_module);
+  error = wasmtime_module_new(engine, (uint8_t *)linking2_wasm.data,
+                              linking2_wasm.size, &linking2_module);
   if (error != NULL)
     exit_with_error("failed to compile linking2", error, NULL);
   wasm_byte_vec_delete(&linking1_wasm);
@@ -80,18 +84,21 @@ int main() {
 
   // Instantiate `linking2` with our linker.
   wasmtime_instance_t linking2;
-  error = wasmtime_linker_instantiate(linker, context, linking2_module, &linking2, &trap);
+  error = wasmtime_linker_instantiate(linker, context, linking2_module,
+                                      &linking2, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to instantiate linking2", error, trap);
 
   // Register our new `linking2` instance with the linker
-  error = wasmtime_linker_define_instance(linker, context, "linking2", strlen("linking2"), &linking2);
+  error = wasmtime_linker_define_instance(linker, context, "linking2",
+                                          strlen("linking2"), &linking2);
   if (error != NULL)
     exit_with_error("failed to link linking2", error, NULL);
 
   // Instantiate `linking1` with the linker now that `linking2` is defined
   wasmtime_instance_t linking1;
-  error = wasmtime_linker_instantiate(linker, context, linking1_module, &linking1, &trap);
+  error = wasmtime_linker_instantiate(linker, context, linking1_module,
+                                      &linking1, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to instantiate linking1", error, trap);
 
@@ -113,14 +120,11 @@ int main() {
   return 0;
 }
 
-static void read_wat_file(
-  wasm_engine_t *engine,
-  wasm_byte_vec_t *bytes,
-  const char *filename
-) {
+static void read_wat_file(wasm_engine_t *engine, wasm_byte_vec_t *bytes,
+                          const char *filename) {
   wasm_byte_vec_t wat;
   // Load our input file to parse it next
-  FILE* file = fopen(filename, "r");
+  FILE *file = fopen(filename, "r");
   if (!file) {
     printf("> Error loading file!\n");
     exit(1);
@@ -142,7 +146,8 @@ static void read_wat_file(
   wasm_byte_vec_delete(&wat);
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -152,7 +157,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/memory.c b/examples/memory.c
index 37eaf0e13..3f4bf311e 100644
--- a/examples/memory.c
+++ b/examples/memory.c
@@ -32,7 +32,8 @@ originally
 #include <wasm.h>
 #include <wasmtime.h>
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 void check(bool success) {
   if (!success) {
@@ -41,16 +42,12 @@ void check(bool success) {
   }
 }
 
-void check_call(wasmtime_context_t *store,
-                wasmtime_func_t *func,
-                const wasmtime_val_t* args,
-                size_t nargs,
-                int32_t expected) {
+void check_call(wasmtime_context_t *store, wasmtime_func_t *func,
+                const wasmtime_val_t *args, size_t nargs, int32_t expected) {
   wasmtime_val_t results[1];
   wasm_trap_t *trap = NULL;
-  wasmtime_error_t *error = wasmtime_func_call(
-      store, func, args, nargs, results, 1, &trap
-  );
+  wasmtime_error_t *error =
+      wasmtime_func_call(store, func, args, nargs, results, 1, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to call function", error, trap);
   if (results[0].of.i32 != expected) {
@@ -59,18 +56,21 @@ void check_call(wasmtime_context_t *store,
   }
 }
 
-void check_call0(wasmtime_context_t *store, wasmtime_func_t *func, int32_t expected) {
+void check_call0(wasmtime_context_t *store, wasmtime_func_t *func,
+                 int32_t expected) {
   check_call(store, func, NULL, 0, expected);
 }
 
-void check_call1(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg, int32_t expected) {
+void check_call1(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg,
+                 int32_t expected) {
   wasmtime_val_t args[1];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg;
   check_call(store, func, args, 1, expected);
 }
 
-void check_call2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1, int32_t arg2, int32_t expected) {
+void check_call2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
+                 int32_t arg2, int32_t expected) {
   wasmtime_val_t args[2];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg1;
@@ -79,14 +79,17 @@ void check_call2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
   check_call(store, func, args, 2, expected);
 }
 
-void check_ok(wasmtime_context_t *store, wasmtime_func_t *func, const wasmtime_val_t* args, size_t nargs) {
+void check_ok(wasmtime_context_t *store, wasmtime_func_t *func,
+              const wasmtime_val_t *args, size_t nargs) {
   wasm_trap_t *trap = NULL;
-  wasmtime_error_t *error = wasmtime_func_call(store, func, args, nargs, NULL, 0, &trap);
+  wasmtime_error_t *error =
+      wasmtime_func_call(store, func, args, nargs, NULL, 0, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to call function", error, trap);
 }
 
-void check_ok2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1, int32_t arg2) {
+void check_ok2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
+               int32_t arg2) {
   wasmtime_val_t args[2];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg1;
@@ -95,15 +98,13 @@ void check_ok2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1, i
   check_ok(store, func, args, 2);
 }
 
-void check_trap(wasmtime_context_t *store,
-                wasmtime_func_t *func,
-                const wasmtime_val_t *args,
-                size_t nargs,
-                size_t num_results) {
+void check_trap(wasmtime_context_t *store, wasmtime_func_t *func,
+                const wasmtime_val_t *args, size_t nargs, size_t num_results) {
   assert(num_results <= 1);
   wasmtime_val_t results[1];
   wasm_trap_t *trap = NULL;
-  wasmtime_error_t *error = wasmtime_func_call(store, func, args, nargs, results, num_results, &trap);
+  wasmtime_error_t *error =
+      wasmtime_func_call(store, func, args, nargs, results, num_results, &trap);
   if (error != NULL)
     exit_with_error("failed to call function", error, NULL);
   if (trap == NULL) {
@@ -113,14 +114,16 @@ void check_trap(wasmtime_context_t *store,
   wasm_trap_delete(trap);
 }
 
-void check_trap1(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg) {
+void check_trap1(wasmtime_context_t *store, wasmtime_func_t *func,
+                 int32_t arg) {
   wasmtime_val_t args[1];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg;
   check_trap(store, func, args, 1, 1);
 }
 
-void check_trap2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1, int32_t arg2) {
+void check_trap2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
+                 int32_t arg2) {
   wasmtime_val_t args[2];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg1;
@@ -129,15 +132,15 @@ void check_trap2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
   check_trap(store, func, args, 2, 0);
 }
 
-int main(int argc, const char* argv[]) {
+int main(int argc, const char *argv[]) {
   // Initialize.
   printf("Initializing...\n");
-  wasm_engine_t* engine = wasm_engine_new();
-  wasmtime_store_t* store = wasmtime_store_new(engine, NULL, NULL);
+  wasm_engine_t *engine = wasm_engine_new();
+  wasmtime_store_t *store = wasmtime_store_new(engine, NULL, NULL);
   wasmtime_context_t *context = wasmtime_store_context(store);
 
   // Load our input file to parse it next
-  FILE* file = fopen("examples/memory.wat", "r");
+  FILE *file = fopen("examples/memory.wat", "r");
   if (!file) {
     printf("> Error loading file!\n");
     return 1;
@@ -162,8 +165,9 @@ int main(int argc, const char* argv[]) {
 
   // Compile.
   printf("Compiling module...\n");
-  wasmtime_module_t* module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) binary.data, binary.size, &module);
+  wasmtime_module_t *module = NULL;
+  error =
+      wasmtime_module_new(engine, (uint8_t *)binary.data, binary.size, &module);
   if (error)
     exit_with_error("failed to compile module", error, NULL);
   wasm_byte_vec_delete(&binary);
@@ -183,16 +187,20 @@ int main(int argc, const char* argv[]) {
   wasmtime_func_t size_func, load_func, store_func;
   wasmtime_extern_t item;
   bool ok;
-  ok = wasmtime_instance_export_get(context, &instance, "memory", strlen("memory"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "memory",
+                                    strlen("memory"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_MEMORY);
   memory = item.of.memory;
-  ok = wasmtime_instance_export_get(context, &instance, "size", strlen("size"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "size", strlen("size"),
+                                    &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   size_func = item.of.func;
-  ok = wasmtime_instance_export_get(context, &instance, "load", strlen("load"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "load", strlen("load"),
+                                    &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   load_func = item.of.func;
-  ok = wasmtime_instance_export_get(context, &instance, "store", strlen("store"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "store",
+                                    strlen("store"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   store_func = item.of.func;
 
@@ -246,7 +254,7 @@ int main(int argc, const char* argv[]) {
   // Create stand-alone memory.
   printf("Creating stand-alone memory...\n");
   wasm_limits_t limits = {5, 5};
-  wasm_memorytype_t* memorytype = wasm_memorytype_new(&limits);
+  wasm_memorytype_t *memorytype = wasm_memorytype_new(&limits);
   wasmtime_memory_t memory2;
   error = wasmtime_memory_new(context, memorytype, &memory2);
   if (error != NULL)
@@ -264,7 +272,8 @@ int main(int argc, const char* argv[]) {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -274,7 +283,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/multi.c b/examples/multi.c
index 4039e2a89..6edcdd18b 100644
--- a/examples/multi.c
+++ b/examples/multi.c
@@ -25,26 +25,22 @@ https://github.com/WebAssembly/wasm-c-api/blob/master/example/multi.c
 originally
 */
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
 #include <wasm.h>
 #include <wasmtime.h>
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 // A function to be called from Wasm code.
-wasm_trap_t* callback(
-  void *env,
-  wasmtime_caller_t *caller,
-  const wasmtime_val_t* args,
-  size_t nargs,
-  wasmtime_val_t* results,
-  size_t nresults
-) {
+wasm_trap_t *callback(void *env, wasmtime_caller_t *caller,
+                      const wasmtime_val_t *args, size_t nargs,
+                      wasmtime_val_t *results, size_t nresults) {
   printf("Calling back...\n");
-  printf("> %"PRIu32" %"PRIu64"\n", args[0].of.i32, args[1].of.i64);
+  printf("> %" PRIu32 " %" PRIu64 "\n", args[0].of.i32, args[1].of.i64);
   printf("\n");
 
   results[0] = args[1];
@@ -52,17 +48,11 @@ wasm_trap_t* callback(
   return NULL;
 }
 
-
 // A function closure.
-wasm_trap_t* closure_callback(
-  void* env,
-  wasmtime_caller_t *caller,
-  const wasmtime_val_t* args,
-  size_t nargs,
-  wasmtime_val_t* results,
-  size_t nresults
-) {
-  int i = *(int*)env;
+wasm_trap_t *closure_callback(void *env, wasmtime_caller_t *caller,
+                              const wasmtime_val_t *args, size_t nargs,
+                              wasmtime_val_t *results, size_t nresults) {
+  int i = *(int *)env;
   printf("Calling back closure...\n");
   printf("> %d\n", i);
 
@@ -71,16 +61,15 @@ wasm_trap_t* closure_callback(
   return NULL;
 }
 
-
-int main(int argc, const char* argv[]) {
+int main(int argc, const char *argv[]) {
   // Initialize.
   printf("Initializing...\n");
-  wasm_engine_t* engine = wasm_engine_new();
-  wasmtime_store_t* store = wasmtime_store_new(engine, NULL, NULL);
+  wasm_engine_t *engine = wasm_engine_new();
+  wasmtime_store_t *store = wasmtime_store_new(engine, NULL, NULL);
   wasmtime_context_t *context = wasmtime_store_context(store);
 
   // Load our input file to parse it next
-  FILE* file = fopen("examples/multi.wat", "r");
+  FILE *file = fopen("examples/multi.wat", "r");
   if (!file) {
     printf("> Error loading file!\n");
     return 1;
@@ -105,22 +94,21 @@ int main(int argc, const char* argv[]) {
 
   // Compile.
   printf("Compiling module...\n");
-  wasmtime_module_t* module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) binary.data, binary.size, &module);
+  wasmtime_module_t *module = NULL;
+  error =
+      wasmtime_module_new(engine, (uint8_t *)binary.data, binary.size, &module);
   if (error)
     exit_with_error("failed to compile module", error, NULL);
   wasm_byte_vec_delete(&binary);
 
   // Create external print functions.
   printf("Creating callback...\n");
-  wasm_functype_t* callback_type = wasm_functype_new_2_2(
-      wasm_valtype_new_i32(),
-      wasm_valtype_new_i64(),
-      wasm_valtype_new_i64(),
-      wasm_valtype_new_i32()
-  );
+  wasm_functype_t *callback_type =
+      wasm_functype_new_2_2(wasm_valtype_new_i32(), wasm_valtype_new_i64(),
+                            wasm_valtype_new_i64(), wasm_valtype_new_i32());
   wasmtime_func_t callback_func;
-  wasmtime_func_new(context, callback_type, callback, NULL, NULL, &callback_func);
+  wasmtime_func_new(context, callback_type, callback, NULL, NULL,
+                    &callback_func);
   wasm_functype_delete(callback_type);
 
   // Instantiate.
@@ -129,7 +117,7 @@ int main(int argc, const char* argv[]) {
   imports[0].kind = WASMTIME_EXTERN_FUNC;
   imports[0].of.func = callback_func;
   wasmtime_instance_t instance;
-  wasm_trap_t* trap = NULL;
+  wasm_trap_t *trap = NULL;
   error = wasmtime_instance_new(context, module, imports, 1, &instance, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to instantiate", error, trap);
@@ -156,8 +144,7 @@ int main(int argc, const char* argv[]) {
 
   // Print result.
   printf("Printing result...\n");
-  printf("> %"PRIu64" %"PRIu32"\n",
-    results[0].of.i64, results[1].of.i32);
+  printf("> %" PRIu64 " %" PRIu32 "\n", results[0].of.i64, results[1].of.i32);
 
   assert(results[0].kind == WASMTIME_I64);
   assert(results[0].of.i64 == 2);
@@ -174,7 +161,8 @@ int main(int argc, const char* argv[]) {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -184,7 +172,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/multimemory.c b/examples/multimemory.c
index 3f1823d6d..88f1f5752 100644
--- a/examples/multimemory.c
+++ b/examples/multimemory.c
@@ -17,7 +17,8 @@ to tweak the `-lpthread` and such annotations.
 
 You can also build using cmake:
 
-mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-multimemory
+mkdir build && cd build && cmake .. && \
+  cmake --build . --target wasmtime-multimemory
 */
 
 #include <inttypes.h>
@@ -27,7 +28,8 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-multime
 #include <wasm.h>
 #include <wasmtime.h>
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 void check(bool success) {
   if (!success) {
@@ -36,16 +38,12 @@ void check(bool success) {
   }
 }
 
-void check_call(wasmtime_context_t *store,
-                wasmtime_func_t *func,
-                const wasmtime_val_t* args,
-                size_t nargs,
-                int32_t expected) {
+void check_call(wasmtime_context_t *store, wasmtime_func_t *func,
+                const wasmtime_val_t *args, size_t nargs, int32_t expected) {
   wasmtime_val_t results[1];
   wasm_trap_t *trap = NULL;
-  wasmtime_error_t *error = wasmtime_func_call(
-      store, func, args, nargs, results, 1, &trap
-  );
+  wasmtime_error_t *error =
+      wasmtime_func_call(store, func, args, nargs, results, 1, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to call function", error, trap);
   if (results[0].of.i32 != expected) {
@@ -54,18 +52,21 @@ void check_call(wasmtime_context_t *store,
   }
 }
 
-void check_call0(wasmtime_context_t *store, wasmtime_func_t *func, int32_t expected) {
+void check_call0(wasmtime_context_t *store, wasmtime_func_t *func,
+                 int32_t expected) {
   check_call(store, func, NULL, 0, expected);
 }
 
-void check_call1(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg, int32_t expected) {
+void check_call1(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg,
+                 int32_t expected) {
   wasmtime_val_t args[1];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg;
   check_call(store, func, args, 1, expected);
 }
 
-void check_call2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1, int32_t arg2, int32_t expected) {
+void check_call2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
+                 int32_t arg2, int32_t expected) {
   wasmtime_val_t args[2];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg1;
@@ -74,14 +75,17 @@ void check_call2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
   check_call(store, func, args, 2, expected);
 }
 
-void check_ok(wasmtime_context_t *store, wasmtime_func_t *func, const wasmtime_val_t* args, size_t nargs) {
+void check_ok(wasmtime_context_t *store, wasmtime_func_t *func,
+              const wasmtime_val_t *args, size_t nargs) {
   wasm_trap_t *trap = NULL;
-  wasmtime_error_t *error = wasmtime_func_call(store, func, args, nargs, NULL, 0, &trap);
+  wasmtime_error_t *error =
+      wasmtime_func_call(store, func, args, nargs, NULL, 0, &trap);
   if (error != NULL || trap != NULL)
     exit_with_error("failed to call function", error, trap);
 }
 
-void check_ok2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1, int32_t arg2) {
+void check_ok2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
+               int32_t arg2) {
   wasmtime_val_t args[2];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg1;
@@ -90,15 +94,13 @@ void check_ok2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1, i
   check_ok(store, func, args, 2);
 }
 
-void check_trap(wasmtime_context_t *store,
-                wasmtime_func_t *func,
-                const wasmtime_val_t *args,
-                size_t nargs,
-                size_t num_results) {
+void check_trap(wasmtime_context_t *store, wasmtime_func_t *func,
+                const wasmtime_val_t *args, size_t nargs, size_t num_results) {
   assert(num_results <= 1);
   wasmtime_val_t results[1];
   wasm_trap_t *trap = NULL;
-  wasmtime_error_t *error = wasmtime_func_call(store, func, args, nargs, results, num_results, &trap);
+  wasmtime_error_t *error =
+      wasmtime_func_call(store, func, args, nargs, results, num_results, &trap);
   if (error != NULL)
     exit_with_error("failed to call function", error, NULL);
   if (trap == NULL) {
@@ -108,14 +110,16 @@ void check_trap(wasmtime_context_t *store,
   wasm_trap_delete(trap);
 }
 
-void check_trap1(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg) {
+void check_trap1(wasmtime_context_t *store, wasmtime_func_t *func,
+                 int32_t arg) {
   wasmtime_val_t args[1];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg;
   check_trap(store, func, args, 1, 1);
 }
 
-void check_trap2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1, int32_t arg2) {
+void check_trap2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
+                 int32_t arg2) {
   wasmtime_val_t args[2];
   args[0].kind = WASMTIME_I32;
   args[0].of.i32 = arg1;
@@ -124,7 +128,7 @@ void check_trap2(wasmtime_context_t *store, wasmtime_func_t *func, int32_t arg1,
   check_trap(store, func, args, 2, 0);
 }
 
-int main(int argc, const char* argv[]) {
+int main(int argc, const char *argv[]) {
   // Initialize.
   printf("Initializing...\n");
 
@@ -135,11 +139,11 @@ int main(int argc, const char* argv[]) {
   wasm_engine_t *engine = wasm_engine_new_with_config(config);
   assert(engine != NULL);
 
-  wasmtime_store_t* store = wasmtime_store_new(engine, NULL, NULL);
+  wasmtime_store_t *store = wasmtime_store_new(engine, NULL, NULL);
   wasmtime_context_t *context = wasmtime_store_context(store);
 
   // Load our input file to parse it next
-  FILE* file = fopen("examples/multimemory.wat", "r");
+  FILE *file = fopen("examples/multimemory.wat", "r");
   if (!file) {
     printf("> Error loading file!\n");
     return 1;
@@ -164,8 +168,9 @@ int main(int argc, const char* argv[]) {
 
   // Compile.
   printf("Compiling module...\n");
-  wasmtime_module_t* module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*) binary.data, binary.size, &module);
+  wasmtime_module_t *module = NULL;
+  error =
+      wasmtime_module_new(engine, (uint8_t *)binary.data, binary.size, &module);
   if (error)
     exit_with_error("failed to compile module", error, NULL);
   wasm_byte_vec_delete(&binary);
@@ -185,28 +190,36 @@ int main(int argc, const char* argv[]) {
   wasmtime_func_t size0, load0, store0, size1, load1, store1;
   wasmtime_extern_t item;
   bool ok;
-  ok = wasmtime_instance_export_get(context, &instance, "memory0", strlen("memory0"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "memory0",
+                                    strlen("memory0"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_MEMORY);
   memory0 = item.of.memory;
-  ok = wasmtime_instance_export_get(context, &instance, "size0", strlen("size0"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "size0",
+                                    strlen("size0"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   size0 = item.of.func;
-  ok = wasmtime_instance_export_get(context, &instance, "load0", strlen("load0"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "load0",
+                                    strlen("load0"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   load0 = item.of.func;
-  ok = wasmtime_instance_export_get(context, &instance, "store0", strlen("store0"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "store0",
+                                    strlen("store0"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   store0 = item.of.func;
-  ok = wasmtime_instance_export_get(context, &instance, "memory1", strlen("memory1"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "memory1",
+                                    strlen("memory1"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_MEMORY);
   memory1 = item.of.memory;
-  ok = wasmtime_instance_export_get(context, &instance, "size1", strlen("size1"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "size1",
+                                    strlen("size1"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   size1 = item.of.func;
-  ok = wasmtime_instance_export_get(context, &instance, "load1", strlen("load1"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "load1",
+                                    strlen("load1"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   load1 = item.of.func;
-  ok = wasmtime_instance_export_get(context, &instance, "store1", strlen("store1"), &item);
+  ok = wasmtime_instance_export_get(context, &instance, "store1",
+                                    strlen("store1"), &item);
   assert(ok && item.kind == WASMTIME_EXTERN_FUNC);
   store1 = item.of.func;
 
@@ -315,7 +328,8 @@ int main(int argc, const char* argv[]) {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -325,7 +339,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/serialize.c b/examples/serialize.c
index 19052571d..eec6eb126 100644
--- a/examples/serialize.c
+++ b/examples/serialize.c
@@ -19,7 +19,8 @@ to tweak the `-lpthread` and such annotations as well as the name of the
 
 You can also build using cmake:
 
-mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-serialize
+mkdir build && cd build && cmake .. && \
+  cmake --build . --target wasmtime-serialize
 */
 
 #include <assert.h>
@@ -28,21 +29,18 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-seriali
 #include <wasm.h>
 #include <wasmtime.h>
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
-static wasm_trap_t* hello_callback(
-    void *env,
-    wasmtime_caller_t *caller,
-    const wasmtime_val_t* args,
-    size_t nargs,
-    wasmtime_val_t* results,
-    size_t nresults) {
+static wasm_trap_t *hello_callback(void *env, wasmtime_caller_t *caller,
+                                   const wasmtime_val_t *args, size_t nargs,
+                                   wasmtime_val_t *results, size_t nresults) {
   printf("Calling back...\n");
   printf("> Hello World!\n");
   return NULL;
 }
 
-int serialize(wasm_byte_vec_t* buffer) {
+int serialize(wasm_byte_vec_t *buffer) {
   // Set up our compilation context. Note that we could also work with a
   // `wasm_config_t` here to configure what feature are enabled and various
   // compilation settings.
@@ -51,7 +49,7 @@ int serialize(wasm_byte_vec_t* buffer) {
   assert(engine != NULL);
 
   // Read our input file, which in this case is a wasm text file.
-  FILE* file = fopen("examples/hello.wat", "r");
+  FILE *file = fopen("examples/hello.wat", "r");
   assert(file != NULL);
   fseek(file, 0L, SEEK_END);
   size_t file_size = ftell(file);
@@ -72,7 +70,7 @@ int serialize(wasm_byte_vec_t* buffer) {
   // and serialize into buffer.
   printf("Compiling and serializing module...\n");
   wasmtime_module_t *module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*)wasm.data, wasm.size, &module);
+  error = wasmtime_module_new(engine, (uint8_t *)wasm.data, wasm.size, &module);
   wasm_byte_vec_delete(&wasm);
   if (error != NULL)
     exit_with_error("failed to compile module", error, NULL);
@@ -87,7 +85,7 @@ int serialize(wasm_byte_vec_t* buffer) {
   return 0;
 }
 
-int deserialize(wasm_byte_vec_t* buffer) {
+int deserialize(wasm_byte_vec_t *buffer) {
   // Set up our compilation context. Note that we could also work with a
   // `wasm_config_t` here to configure what feature are enabled and various
   // compilation settings.
@@ -104,7 +102,8 @@ int deserialize(wasm_byte_vec_t* buffer) {
   // Deserialize compiled module.
   printf("Deserialize module...\n");
   wasmtime_module_t *module = NULL;
-  wasmtime_error_t *error = wasmtime_module_deserialize(engine, (uint8_t*) buffer->data, buffer->size, &module);
+  wasmtime_error_t *error = wasmtime_module_deserialize(
+      engine, (uint8_t *)buffer->data, buffer->size, &module);
   if (error != NULL)
     exit_with_error("failed to compile module", error, NULL);
 
@@ -163,7 +162,8 @@ int main() {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -173,7 +173,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
diff --git a/examples/threads.c b/examples/threads.c
index 707601be5..9329746dc 100644
--- a/examples/threads.c
+++ b/examples/threads.c
@@ -25,64 +25,66 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-threads
 #ifndef _WIN32
 
 #include <inttypes.h>
+#include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <pthread.h>
 #include <unistd.h>
 #include <wasm.h>
 #include <wasmtime.h>
 
 #define own
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 const int N_THREADS = 10;
 const int N_REPS = 3;
 
 // A function to be called from Wasm code.
-own wasm_trap_t* callback(const wasm_val_vec_t* args, wasm_val_vec_t* results) {
+own wasm_trap_t *callback(const wasm_val_vec_t *args, wasm_val_vec_t *results) {
   assert(args->data[0].kind == WASM_I32);
   printf("> Thread %d running\n", args->data[0].of.i32);
   return NULL;
 }
 
-
 typedef struct {
-  wasm_engine_t* engine;
-  wasm_shared_module_t* module;
+  wasm_engine_t *engine;
+  wasm_shared_module_t *module;
   int id;
 } thread_args;
 
-void* run(void* args_abs) {
-  thread_args* args = (thread_args*)args_abs;
+void *run(void *args_abs) {
+  thread_args *args = (thread_args *)args_abs;
 
   // Rereate store and module.
-  own wasm_store_t* store = wasm_store_new(args->engine);
-  own wasm_module_t* module = wasm_module_obtain(store, args->module);
+  own wasm_store_t *store = wasm_store_new(args->engine);
+  own wasm_module_t *module = wasm_module_obtain(store, args->module);
 
   // Run the example N times.
   for (int i = 0; i < N_REPS; ++i) {
     usleep(100000);
 
     // Create imports.
-    own wasm_functype_t* func_type = wasm_functype_new_1_0(wasm_valtype_new_i32());
-    own wasm_func_t* func = wasm_func_new(store, func_type, callback);
+    own wasm_functype_t *func_type =
+        wasm_functype_new_1_0(wasm_valtype_new_i32());
+    own wasm_func_t *func = wasm_func_new(store, func_type, callback);
     wasm_functype_delete(func_type);
 
     wasm_val_t val = {.kind = WASM_I32, .of = {.i32 = (int32_t)args->id}};
-    own wasm_globaltype_t* global_type =
-      wasm_globaltype_new(wasm_valtype_new_i32(), WASM_CONST);
-    own wasm_global_t* global = wasm_global_new(store, global_type, &val);
+    own wasm_globaltype_t *global_type =
+        wasm_globaltype_new(wasm_valtype_new_i32(), WASM_CONST);
+    own wasm_global_t *global = wasm_global_new(store, global_type, &val);
     wasm_globaltype_delete(global_type);
 
     // Instantiate.
-    wasm_extern_t* imports[] = {
-      wasm_func_as_extern(func), wasm_global_as_extern(global),
+    wasm_extern_t *imports[] = {
+        wasm_func_as_extern(func),
+        wasm_global_as_extern(global),
     };
     wasm_extern_vec_t imports_vec = WASM_ARRAY_VEC(imports);
-    own wasm_instance_t* instance =
-      wasm_instance_new(store, module, &imports_vec, NULL);
+    own wasm_instance_t *instance =
+        wasm_instance_new(store, module, &imports_vec, NULL);
     if (!instance) {
       printf("> Error instantiating module!\n");
       return NULL;
@@ -127,10 +129,10 @@ void* run(void* args_abs) {
 
 int main(int argc, const char *argv[]) {
   // Initialize.
-  wasm_engine_t* engine = wasm_engine_new();
+  wasm_engine_t *engine = wasm_engine_new();
 
   // Load our input file to parse it next
-  FILE* file = fopen("examples/threads.wat", "r");
+  FILE *file = fopen("examples/threads.wat", "r");
   if (!file) {
     printf("> Error loading file!\n");
     return 1;
@@ -154,8 +156,8 @@ int main(int argc, const char *argv[]) {
   wasm_byte_vec_delete(&wat);
 
   // Compile and share.
-  own wasm_store_t* store = wasm_store_new(engine);
-  own wasm_module_t* module = wasm_module_new(store, &binary);
+  own wasm_store_t *store = wasm_store_new(engine);
+  own wasm_module_t *module = wasm_module_new(store, &binary);
   if (!module) {
     printf("> Error compiling module!\n");
     return 1;
@@ -163,7 +165,7 @@ int main(int argc, const char *argv[]) {
 
   wasm_byte_vec_delete(&binary);
 
-  own wasm_shared_module_t* shared = wasm_module_share(module);
+  own wasm_shared_module_t *shared = wasm_module_share(module);
 
   wasm_module_delete(module);
   wasm_store_delete(store);
@@ -171,7 +173,7 @@ int main(int argc, const char *argv[]) {
   // Spawn threads.
   pthread_t threads[N_THREADS];
   for (int i = 0; i < N_THREADS; i++) {
-    thread_args* args = malloc(sizeof(thread_args));
+    thread_args *args = malloc(sizeof(thread_args));
     args->id = i;
     args->engine = engine;
     args->module = shared;
@@ -190,7 +192,8 @@ int main(int argc, const char *argv[]) {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -198,14 +201,12 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
   } else {
     wasm_trap_message(trap, &error_message);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }
 
 #else
 // TODO implement example for Windows
-int main(int argc, const char *argv[]) {
-  return 0;
-}
+int main(int argc, const char *argv[]) { return 0; }
 #endif // _WIN32
diff --git a/examples/wasi/main.c b/examples/wasi/main.c
index f55715aa6..753d66497 100644
--- a/examples/wasi/main.c
+++ b/examples/wasi/main.c
@@ -24,13 +24,14 @@ mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-wasi
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <wasm.h>
 #include <wasi.h>
+#include <wasm.h>
 #include <wasmtime.h>
 
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap);
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap);
 
 int main() {
   // Set up our context
@@ -48,7 +49,7 @@ int main() {
 
   wasm_byte_vec_t wasm;
   // Load our input file to parse it next
-  FILE* file = fopen("target/wasm32-wasi/debug/wasi.wasm", "rb");
+  FILE *file = fopen("target/wasm32-wasi/debug/wasi.wasm", "rb");
   if (!file) {
     printf("> Error loading file!\n");
     exit(1);
@@ -65,7 +66,7 @@ int main() {
 
   // Compile our modules
   wasmtime_module_t *module = NULL;
-  error = wasmtime_module_new(engine, (uint8_t*)wasm.data, wasm.size, &module);
+  error = wasmtime_module_new(engine, (uint8_t *)wasm.data, wasm.size, &module);
   if (!module)
     exit_with_error("failed to compile module", error, NULL);
   wasm_byte_vec_delete(&wasm);
@@ -105,7 +106,8 @@ int main() {
   return 0;
 }
 
-static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_trap_t *trap) {
+static void exit_with_error(const char *message, wasmtime_error_t *error,
+                            wasm_trap_t *trap) {
   fprintf(stderr, "error: %s\n", message);
   wasm_byte_vec_t error_message;
   if (error != NULL) {
@@ -115,7 +117,7 @@ static void exit_with_error(const char *message, wasmtime_error_t *error, wasm_t
     wasm_trap_message(trap, &error_message);
     wasm_trap_delete(trap);
   }
-  fprintf(stderr, "%.*s\n", (int) error_message.size, error_message.data);
+  fprintf(stderr, "%.*s\n", (int)error_message.size, error_message.data);
   wasm_byte_vec_delete(&error_message);
   exit(1);
 }


Test patch:
diff --git a/tests/all/debug/testsuite/dead_code.c b/tests/all/debug/testsuite/dead_code.c
index 61067a78d..ea65e8efb 100644
--- a/tests/all/debug/testsuite/dead_code.c
+++ b/tests/all/debug/testsuite/dead_code.c
@@ -1,5 +1,4 @@
-int bar(int a)
-{
+int bar(int a) {
   int b[50];
   b[0] = a;
   b[29] = a;
@@ -8,12 +7,6 @@ int bar(int a)
 
 int baz(int a);
 
-__attribute__((export_name("foo"))) int foo()
-{
-  return baz(10);
-}
+__attribute__((export_name("foo"))) int foo() { return baz(10); }
 
-__attribute__((noinline)) int baz(int a)
-{
-  return a + 5;
-}
+__attribute__((noinline)) int baz(int a) { return a + 5; }
diff --git a/tests/all/debug/testsuite/reverse-str.c b/tests/all/debug/testsuite/reverse-str.c
index 0cad1b2f0..d7585a87f 100644
--- a/tests/all/debug/testsuite/reverse-str.c
+++ b/tests/all/debug/testsuite/reverse-str.c
@@ -3,19 +3,18 @@
 //     -O0 -nostdlib -fdebug-prefix-map=$PWD=.
 #include <stdlib.h>
 
-void reverse(char *s, size_t len)
-{
-    if (!len) return;
-    size_t i = 0, j = len - 1;
-    while (i < j) {
-        char t = s[i];
-        s[i++] = s[j];
-        s[j--] = t;
-    }
+void reverse(char *s, size_t len) {
+  if (!len)
+    return;
+  size_t i = 0, j = len - 1;
+  while (i < j) {
+    char t = s[i];
+    s[i++] = s[j];
+    s[j--] = t;
+  }
 }
 
-void _start()
-{
-    char hello[] = "Hello, world.";
-    reverse(hello, 13);
+void _start() {
+  char hello[] = "Hello, world.";
+  reverse(hello, 13);
 }
diff --git a/tests/all/debug/testsuite/spilled_frame_base.c b/tests/all/debug/testsuite/spilled_frame_base.c
index d07336812..8948ac6cf 100644
--- a/tests/all/debug/testsuite/spilled_frame_base.c
+++ b/tests/all/debug/testsuite/spilled_frame_base.c
@@ -1,16 +1,21 @@
-// Originally built using WASI SDK 20.0, "clang spilled_frame_base.c -o spilled_frame_base.wasm -g -target wasm32-wasi"
-void func_11(int x, int y, int z, int a, int b, int c, int d, int e, int f, int g, int h) { }
-void func_12(int x, int y, int z, int a, int b, int c, int d, int e, int f, int g, int h, int i) { }
-void func_13(int x, int y, int z, int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) { }
-void func_14(int x, int y, int z, int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k) { }
+// Originally built using WASI SDK 20.0, "clang spilled_frame_base.c -o
+// spilled_frame_base.wasm -g -target wasm32-wasi"
+void func_11(int x, int y, int z, int a, int b, int c, int d, int e, int f,
+             int g, int h) {}
+void func_12(int x, int y, int z, int a, int b, int c, int d, int e, int f,
+             int g, int h, int i) {}
+void func_13(int x, int y, int z, int a, int b, int c, int d, int e, int f,
+             int g, int h, int i, int j) {}
+void func_14(int x, int y, int z, int a, int b, int c, int d, int e, int f,
+             int g, int h, int i, int j, int k) {}
 
 int main() {
-    int i = 1;
+  int i = 1;
 
-    func_11(55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65);
-    func_12(66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77);
-    func_13(78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90);
-    func_14(91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104);
+  func_11(55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65);
+  func_12(66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77);
+  func_13(78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90);
+  func_14(91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104);
 
-    return i + i;
+  return i + i;
 }