Skip to content

Commit e3654e8

Browse files
committed
fmt
1 parent 25aeef4 commit e3654e8

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

src/binding.cc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3803,8 +3803,9 @@ void v8__WasmModuleCompilation__DELETE(v8::WasmModuleCompilation* self) {
38033803
delete self;
38043804
}
38053805

3806-
void v8__WasmModuleCompilation__OnBytesReceived(
3807-
v8::WasmModuleCompilation* self, const uint8_t* bytes, size_t size) {
3806+
void v8__WasmModuleCompilation__OnBytesReceived(v8::WasmModuleCompilation* self,
3807+
const uint8_t* bytes,
3808+
size_t size) {
38083809
self->OnBytesReceived(bytes, size);
38093810
}
38103811

@@ -3844,8 +3845,7 @@ class RustCallable {
38443845
void operator()(
38453846
std::variant<v8::Local<v8::WasmModuleObject>, v8::Local<v8::Value>>
38463847
result) {
3847-
if (auto* module =
3848-
std::get_if<v8::Local<v8::WasmModuleObject>>(&result)) {
3848+
if (auto* module = std::get_if<v8::Local<v8::WasmModuleObject>>(&result)) {
38493849
callback_(data_, local_to_ptr(*module), nullptr);
38503850
} else {
38513851
callback_(data_, nullptr,
@@ -3866,14 +3866,12 @@ class RustCallable {
38663866
void v8__WasmModuleCompilation__Finish(
38673867
v8::WasmModuleCompilation* self, v8::Isolate* isolate,
38683868
void (*caching_callback)(v8::WasmStreaming::ModuleCachingInterface&),
3869-
void (*resolution_callback)(void* data,
3870-
const v8::WasmModuleObject* module,
3869+
void (*resolution_callback)(void* data, const v8::WasmModuleObject* module,
38713870
const v8::Value* error),
3872-
void* resolution_data,
3873-
void (*drop_resolution_data)(void* data)) {
3874-
self->Finish(isolate, caching_callback,
3875-
RustCallable(resolution_callback, resolution_data,
3876-
drop_resolution_data));
3871+
void* resolution_data, void (*drop_resolution_data)(void* data)) {
3872+
self->Finish(
3873+
isolate, caching_callback,
3874+
RustCallable(resolution_callback, resolution_data, drop_resolution_data));
38773875
}
38783876

38793877
void v8__WasmModuleCompilation__Abort(v8::WasmModuleCompilation* self) {

src/wasm.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,15 @@ impl WasmModuleCompilation {
329329
scope: &mut PinScope,
330330
caching_callback: Option<ModuleCachingCallback>,
331331
resolution_callback: impl FnOnce(
332-
&Isolate,
333-
Result<Local<'_, WasmModuleObject>, Local<'_, Value>>,
334-
) + 'static,
332+
&Isolate,
333+
Result<Local<'_, WasmModuleObject>, Local<'_, Value>>,
334+
) + 'static,
335335
) {
336336
// Capture the isolate pointer in the closure so it doesn't need to be
337337
// threaded through C++.
338338
let isolate_ptr = scope.get_isolate_ptr();
339-
let wrapped = move |module: *const WasmModuleObject, error: *const Value| {
339+
let wrapped = move |module: *const WasmModuleObject,
340+
error: *const Value| {
340341
let isolate = unsafe { Isolate::from_raw_ptr(isolate_ptr) };
341342
if !module.is_null() {
342343
resolution_callback(
@@ -457,9 +458,8 @@ unsafe extern "C" fn serialization_trampoline(
457458
data: *mut c_void,
458459
compiled_module: *mut InternalCompiledWasmModule,
459460
) {
460-
let callback = unsafe {
461-
&**(data as *const Box<dyn Fn(CompiledWasmModule) + Send>)
462-
};
461+
let callback =
462+
unsafe { &**(data as *const Box<dyn Fn(CompiledWasmModule) + Send>) };
463463
callback(CompiledWasmModule(compiled_module));
464464
}
465465

@@ -596,9 +596,7 @@ unsafe extern "C" {
596596
resolution_data: *mut c_void,
597597
drop_resolution_data: unsafe extern "C" fn(*mut c_void),
598598
);
599-
fn v8__WasmModuleCompilation__Abort(
600-
this: *mut InternalWasmModuleCompilation,
601-
);
599+
fn v8__WasmModuleCompilation__Abort(this: *mut InternalWasmModuleCompilation);
602600
fn v8__WasmModuleCompilation__SetHasCompiledModuleBytes(
603601
this: *mut InternalWasmModuleCompilation,
604602
);

tests/test_api.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8807,7 +8807,9 @@ fn wasm_module_compilation() {
88078807
let result_clone = result.clone();
88088808
compilation.finish(scope, None, move |isolate, r| match r {
88098809
Ok(module) => {
8810-
result_clone.borrow_mut().replace(v8::Global::new(isolate, module));
8810+
result_clone
8811+
.borrow_mut()
8812+
.replace(v8::Global::new(isolate, module));
88118813
}
88128814
Err(_) => panic!("wasm compilation failed"),
88138815
});

0 commit comments

Comments
 (0)