Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrieshiemstra committed Sep 16, 2024
1 parent d151fde commit 22a7bb4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
1 change: 0 additions & 1 deletion src/quickjsrealmadapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::ffi::CString;
use std::future::Future;
use std::i32;
use std::os::raw::c_void;
use std::rc::Rc;
use std::sync::{Arc, Weak};
Expand Down
42 changes: 20 additions & 22 deletions src/quickjsruntimeadapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,30 +213,28 @@ unsafe extern "C" fn native_module_init(

QuickJsRuntimeAdapter::do_with(|q_js_rt| {
QuickJsRealmAdapter::with_context(ctx, |q_ctx| {
if let Some(res) = q_js_rt.with_all_module_loaders(|module_loader| {
if module_loader.has_module(q_ctx, module_name.as_str()) {
match module_loader.init_module(q_ctx, module) {
Ok(_) => {
Some(0) // ok
}
Err(e) => {
q_ctx.report_ex(
format!(
"Failed to init native module: {module_name} caused by {e}"
)
.as_str(),
);
Some(1)
q_js_rt
.with_all_module_loaders(|module_loader| {
if module_loader.has_module(q_ctx, module_name.as_str()) {
match module_loader.init_module(q_ctx, module) {
Ok(_) => {
Some(0) // ok
}
Err(e) => {
q_ctx.report_ex(
format!(
"Failed to init native module: {module_name} caused by {e}"
)
.as_str(),
);
Some(1)
}
}
} else {
None
}
} else {
None
}
}) {
res
} else {
0
}
})
.unwrap_or(0)
})
})
}
Expand Down

0 comments on commit 22a7bb4

Please sign in to comment.