Skip to content

Commit 708a707

Browse files
committed
Fix lints
1 parent 8092d90 commit 708a707

5 files changed

Lines changed: 25 additions & 21 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ console = "=0.16.3"
2222
ctrlc = "=3.5.2"
2323
ecmascript_atomics = { version = "=0.2.3" }
2424
fast-float = "=0.2.0"
25-
hashbrown = "=0.17.0"
25+
hashbrown = "=0.17.1"
2626
lexical = { version = "=7.0.5", default-features = false, features = [
2727
"std",
2828
"write-integers",

nova_vm/src/ecmascript/builtins/structured_data/atomics_object.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ fn do_wait_critical<'gc, const IS_ASYNC: bool, const IS_I64: bool>(
15031503
let (new_guard, timeout) = waiter_record.wait_timeout(guard, dur);
15041504
guard = new_guard;
15051505
if timeout.timed_out() {
1506-
guard.remove_from_list(byte_index_in_buffer, waiter_record);
1506+
guard.remove_from_list(byte_index_in_buffer, &waiter_record);
15071507

15081508
// 31. Perform LeaveCriticalSection(WL).
15091509
// 32. If mode is sync, return waiterRecord.[[Result]].
@@ -1645,16 +1645,15 @@ impl WaitAsyncJob {
16451645
self.0._has_timeout
16461646
}
16471647

1648-
/// Implementation of the Job Abstract Closure for [WaitAsyncTimeoutJob](https://tc39.es/ecma262/#sec-enqueueatomicswaitasynctimeoutjob),
1648+
/// Implementation of the Job Abstract Closure for
1649+
/// [WaitAsyncTimeoutJob](https://tc39.es/ecma262/#sec-enqueueatomicswaitasynctimeoutjob),
16491650
/// for the cases where no timeout is specified.
1650-
pub(crate) fn run<'gc>(self, agent: &mut Agent, gc: GcScope<'gc, '_>) -> JsResult<'gc, ()> {
1651-
let gc = gc.into_nogc();
1652-
1651+
pub(crate) fn run<'gc>(self, agent: &mut Agent, gc: NoGcScope<'gc, '_>) -> JsResult<'gc, ()> {
16531652
let waiters = get_wait_async_job_waiters(&self.0.data_block);
16541653

16551654
let mut guard = waiters.lock().unwrap();
16561655
let waiter_record = self.0.waiter_record;
1657-
guard.remove_from_list(self.0.byte_index_in_buffer, waiter_record.clone());
1656+
guard.remove_from_list(self.0.byte_index_in_buffer, &waiter_record);
16581657

16591658
let result = match waiter_record.get_result() {
16601659
Some(WaitResult::TimedOut) => WaitResult::TimedOut,
@@ -1683,24 +1682,28 @@ struct WaitAsyncTimeoutJobInner {
16831682
pub(crate) struct WaitAsyncTimeoutJob(Box<WaitAsyncTimeoutJobInner>);
16841683

16851684
impl WaitAsyncTimeoutJob {
1686-
pub(crate) fn run<'gc>(self, _agent: &mut Agent, _gc: GcScope<'gc, '_>) -> JsResult<'gc, ()> {
1687-
if self.0.waiter_record.get_result().is_some() {
1688-
return Ok(());
1685+
pub(crate) fn run<'gc>(self) {
1686+
let WaitAsyncTimeoutJobInner {
1687+
data_block,
1688+
byte_index_in_buffer,
1689+
waiter_record,
1690+
} = *self.0;
1691+
if waiter_record.get_result().is_some() {
1692+
return;
16891693
}
16901694

1691-
let waiters = get_wait_async_job_waiters(&self.0.data_block);
1695+
let waiters = get_wait_async_job_waiters(&data_block);
16921696
// a. Perform EnterCriticalSection(WL).
16931697
let mut guard = waiters.lock().unwrap();
16941698

16951699
// b. If WL.[[Waiters]] contains waiterRecord, then
16961700
// i. Let timeOfJobExecution be the time value (UTC) identifying the current time.
16971701
// ii. Assert: ℝ(timeOfJobExecution) ≥ waiterRecord.[[TimeoutTime]] (ignoring potential non-monotonicity of time values).
16981702
// iii. Set waiterRecord.[[Result]] to "timed-out".
1699-
self.0.waiter_record.set_result(WaitResult::TimedOut);
1703+
waiter_record.set_result(WaitResult::TimedOut);
17001704

17011705
// iv. Perform RemoveWaiter(WL, waiterRecord).
1702-
let waiter_record = self.0.waiter_record.clone();
1703-
guard.remove_from_list(self.0.byte_index_in_buffer, self.0.waiter_record);
1706+
guard.remove_from_list(byte_index_in_buffer, &waiter_record);
17041707

17051708
// v. Perform NotifyWaiter(WL, waiterRecord).
17061709
waiter_record.notify_waiters();
@@ -1709,7 +1712,6 @@ impl WaitAsyncTimeoutJob {
17091712
drop(guard);
17101713

17111714
// d. Return unused.
1712-
Ok(())
17131715
}
17141716
}
17151717

nova_vm/src/ecmascript/builtins/temporal/plain_time.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ pub(crate) fn create_temporal_plain_time<'gc>(
143143
/// a normal completion containing a Temporal.PlainTime or a throw completion.
144144
/// It adds/subtracts temporalDurationLike to/from temporalTime, returning a
145145
/// point in time that is in the future/past relative to temporalTime.
146-
/// It performs the following steps when called:
147146
fn add_duration_to_time<'gc, const IS_ADD: bool>(
148147
agent: &mut Agent,
149148
plan_time: TemporalPlainTime,

nova_vm/src/ecmascript/execution/agent.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,12 @@ impl Job {
316316
InnerJob::PromiseResolveThenable(job) => job.run(agent, gc),
317317
InnerJob::PromiseReaction(job) => job.run(agent, gc),
318318
#[cfg(feature = "atomics")]
319-
InnerJob::WaitAsync(job) => job.run(agent, gc),
319+
InnerJob::WaitAsync(job) => job.run(agent, gc.into_nogc()),
320320
#[cfg(feature = "atomics")]
321-
InnerJob::WaitAsyncTimeout(job) => job.run(agent, gc),
321+
InnerJob::WaitAsyncTimeout(job) => {
322+
job.run();
323+
Ok(())
324+
}
322325
#[cfg(feature = "weak-refs")]
323326
InnerJob::FinalizationRegistry(job) => {
324327
job.run(agent, gc);

nova_vm/src/ecmascript/types/spec/data_block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,12 @@ impl WaiterList {
541541
self.waiters.push_back(w);
542542
}
543543

544-
pub(crate) fn remove(&mut self, w: Arc<WaiterRecord>) -> bool {
544+
pub(crate) fn remove(&mut self, w: &Arc<WaiterRecord>) -> bool {
545545
let Some(index) = self
546546
.waiters
547547
.iter()
548548
.enumerate()
549-
.find(|(_, e)| Arc::ptr_eq(e, &w))
549+
.find(|(_, e)| Arc::ptr_eq(e, w))
550550
.map(|(i, _)| i)
551551
else {
552552
return false;
@@ -572,7 +572,7 @@ impl WaiterLists {
572572
self.map.entry(index).or_default().push(w);
573573
}
574574

575-
pub(crate) fn remove_from_list(&mut self, index: usize, w: Arc<WaiterRecord>) {
575+
pub(crate) fn remove_from_list(&mut self, index: usize, w: &Arc<WaiterRecord>) {
576576
match self.map.entry(index) {
577577
Entry::Occupied(mut entry) => {
578578
if entry.get_mut().remove(w) && entry.get().is_empty() {

0 commit comments

Comments
 (0)