Elide lifetimes where possible

This commit is contained in:
Filip Tibell 2023-02-13 21:31:19 +01:00
parent 805b9d89ad
commit e3e56301ce
No known key found for this signature in database

View file

@ -191,11 +191,11 @@ impl<'fut> TaskScheduler<'fut> {
for it, as well as the arguments to give the for it, as well as the arguments to give the
thread on resumption, in the Lua registry. thread on resumption, in the Lua registry.
*/ */
fn create_task<'a>( fn create_task(
&self, &self,
kind: TaskKind, kind: TaskKind,
thread_or_function: LuaValue<'a>, thread_or_function: LuaValue<'_>,
thread_args: Option<LuaMultiValue<'a>>, thread_args: Option<LuaMultiValue<'_>>,
) -> LuaResult<TaskReference> { ) -> LuaResult<TaskReference> {
// Get or create a thread from the given argument // Get or create a thread from the given argument
let task_thread = match thread_or_function { let task_thread = match thread_or_function {
@ -244,11 +244,11 @@ impl<'fut> TaskScheduler<'fut> {
-- Here we have either yielded or finished the above task -- Here we have either yielded or finished the above task
``` ```
*/ */
fn schedule<'a>( fn schedule(
&self, &self,
kind: TaskKind, kind: TaskKind,
thread_or_function: LuaValue<'a>, thread_or_function: LuaValue<'_>,
thread_args: Option<LuaMultiValue<'a>>, thread_args: Option<LuaMultiValue<'_>>,
after_current_resume: bool, after_current_resume: bool,
) -> LuaResult<TaskReference> { ) -> LuaResult<TaskReference> {
if kind == TaskKind::Future { if kind == TaskKind::Future {
@ -278,10 +278,10 @@ impl<'fut> TaskScheduler<'fut> {
Ok(task_ref) Ok(task_ref)
} }
pub fn schedule_current_resume<'a>( pub fn schedule_current_resume(
&self, &self,
thread_or_function: LuaValue<'a>, thread_or_function: LuaValue<'_>,
thread_args: LuaMultiValue<'a>, thread_args: LuaMultiValue<'_>,
) -> LuaResult<TaskReference> { ) -> LuaResult<TaskReference> {
self.schedule( self.schedule(
TaskKind::Instant, TaskKind::Instant,
@ -291,10 +291,10 @@ impl<'fut> TaskScheduler<'fut> {
) )
} }
pub fn schedule_after_current_resume<'a>( pub fn schedule_after_current_resume(
&self, &self,
thread_or_function: LuaValue<'a>, thread_or_function: LuaValue<'_>,
thread_args: LuaMultiValue<'a>, thread_args: LuaMultiValue<'_>,
) -> LuaResult<TaskReference> { ) -> LuaResult<TaskReference> {
self.schedule( self.schedule(
TaskKind::Instant, TaskKind::Instant,
@ -304,10 +304,10 @@ impl<'fut> TaskScheduler<'fut> {
) )
} }
pub fn schedule_deferred<'a>( pub fn schedule_deferred(
&self, &self,
thread_or_function: LuaValue<'a>, thread_or_function: LuaValue<'_>,
thread_args: LuaMultiValue<'a>, thread_args: LuaMultiValue<'_>,
) -> LuaResult<TaskReference> { ) -> LuaResult<TaskReference> {
self.schedule( self.schedule(
TaskKind::Deferred, TaskKind::Deferred,
@ -317,11 +317,11 @@ impl<'fut> TaskScheduler<'fut> {
) )
} }
pub fn schedule_delayed<'a>( pub fn schedule_delayed(
&self, &self,
after_secs: f64, after_secs: f64,
thread_or_function: LuaValue<'a>, thread_or_function: LuaValue<'_>,
thread_args: LuaMultiValue<'a>, thread_args: LuaMultiValue<'_>,
) -> LuaResult<TaskReference> { ) -> LuaResult<TaskReference> {
let task_ref = self.create_task(TaskKind::Future, thread_or_function, Some(thread_args))?; let task_ref = self.create_task(TaskKind::Future, thread_or_function, Some(thread_args))?;
let futs = self let futs = self