Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/oxlint/src/js_plugins/external_linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ fn wrap_setup_configs(cb: JsSetupConfigsCb) -> ExternalLinterSetupConfigsCb {
options_json,
ThreadsafeFunctionCallMode::NonBlocking,
move |result, _env| {
let _ = tx.send(result);
// This call cannot fail, because `rx.recv()` below blocks until it receives a message.
// This closure is a `FnOnce`, so it can't be called more than once, so only 1 message can be sent.
// Therefore, `rx` cannot be dropped before this call.
let res = tx.send(result);
debug_assert!(res.is_ok(), "Failed to send result of `setupConfigs`");
Ok(())
},
);
Expand Down Expand Up @@ -146,7 +150,11 @@ fn wrap_lint_file(cb: JsLintFileCb) -> ExternalLinterLintFileCb {
FnArgs::from((file_path, buffer_id, buffer, rule_ids, options_ids, settings_json)),
ThreadsafeFunctionCallMode::NonBlocking,
move |result, _env| {
let _ = tx.send(result);
// This call cannot fail, because `rx.recv()` below blocks until it receives a message.
// This closure is a `FnOnce`, so it can't be called more than once, so only 1 message can be sent.
// Therefore, `rx` cannot be dropped before this call.
let res = tx.send(result);
debug_assert!(res.is_ok(), "Failed to send result of `lintFile`");
Ok(())
},
);
Expand Down
Loading