Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Dec 17, 2024
1 parent 118e1e3 commit 8b742ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tooling/nargo/src/foreign_calls/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ impl<F> ForeignCallExecutor<F> for RPCForeignCallExecutor
where
F: AcirField + Serialize + for<'a> Deserialize<'a>,
{
/// Execute an async call blocking the current thread.
/// This method cannot be called from inside a `tokio` runtime, for that to work
/// we need to offload the execution into a different thread; see the tests.
fn execute(&mut self, foreign_call: &ForeignCallWaitInfo<F>) -> ResolveForeignCallResult<F> {
let encoded_params = rpc_params!(ResolveForeignCallRequest {
session_id: self.id,
Expand All @@ -112,7 +115,6 @@ where

#[cfg(test)]
mod tests {

use acvm::{
acir::brillig::ForeignCallParam, brillig_vm::brillig::ForeignCallResult,
pwg::ForeignCallWaitInfo, FieldElement,
Expand Down Expand Up @@ -185,12 +187,14 @@ mod tests {
/// Spawn and run the executor in the background until all clients are closed.
fn run(mut self) -> RPCForeignCallClient {
let (tx, mut rx) = mpsc::unbounded_channel::<RPCForeignCallClientRequest>();
let _ = tokio::task::spawn_blocking(move || {
let handle = tokio::task::spawn_blocking(move || {
while let Some((req, tx)) = rx.blocking_recv() {
let res = self.execute(&req);
let _ = tx.send(res);
}
});
// The task will finish when the client goes out of scope.
drop(handle);
RPCForeignCallClient { tx }
}
}
Expand Down

0 comments on commit 8b742ff

Please sign in to comment.