From 2fd0291a8180cba8a6d503229eeef7bd1b744796 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 26 Sep 2023 13:42:11 +0200 Subject: [PATCH] Remove unnecessary 'static bounds --- crates/typst/src/ide/complete.rs | 6 +++--- crates/typst/src/ide/tooltip.rs | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/crates/typst/src/ide/complete.rs b/crates/typst/src/ide/complete.rs index 9c1796abe..27623fc21 100644 --- a/crates/typst/src/ide/complete.rs +++ b/crates/typst/src/ide/complete.rs @@ -27,7 +27,7 @@ use crate::World; /// When `explicit` is `true`, the user requested the completion by pressing /// control and space or something similar. pub fn autocomplete( - world: &(dyn World + 'static), + world: &dyn World, frames: &[Frame], source: &Source, cursor: usize, @@ -944,7 +944,7 @@ fn code_completions(ctx: &mut CompletionContext, hashtag: bool) { /// Context for autocompletion. struct CompletionContext<'a> { - world: &'a (dyn World + 'static), + world: &'a (dyn World + 'a), frames: &'a [Frame], library: &'a Library, global: &'a Scope, @@ -963,7 +963,7 @@ struct CompletionContext<'a> { impl<'a> CompletionContext<'a> { /// Create a new autocompletion context. fn new( - world: &'a (dyn World + 'static), + world: &'a (dyn World + 'a), frames: &'a [Frame], source: &'a Source, cursor: usize, diff --git a/crates/typst/src/ide/tooltip.rs b/crates/typst/src/ide/tooltip.rs index 6f8c89277..b9dd17f73 100644 --- a/crates/typst/src/ide/tooltip.rs +++ b/crates/typst/src/ide/tooltip.rs @@ -16,7 +16,7 @@ use crate::World; /// Describe the item under the cursor. pub fn tooltip( - world: &(dyn World + 'static), + world: &dyn World, frames: &[Frame], source: &Source, cursor: usize, @@ -43,7 +43,7 @@ pub enum Tooltip { } /// Tooltip for a hovered expression. -fn expr_tooltip(world: &(dyn World + 'static), leaf: &LinkedNode) -> Option { +fn expr_tooltip(world: &dyn World, leaf: &LinkedNode) -> Option { let mut ancestor = leaf; while !ancestor.is::() { ancestor = ancestor.parent()?; @@ -143,7 +143,7 @@ fn length_tooltip(length: Length) -> Option { /// Tooltip for a hovered reference. fn ref_tooltip( - world: &(dyn World + 'static), + world: &dyn World, frames: &[Frame], leaf: &LinkedNode, ) -> Option { @@ -162,10 +162,7 @@ fn ref_tooltip( } /// Tooltips for components of a named parameter. -fn named_param_tooltip( - world: &(dyn World + 'static), - leaf: &LinkedNode, -) -> Option { +fn named_param_tooltip(world: &dyn World, leaf: &LinkedNode) -> Option { let (func, named) = if_chain! { // Ensure that we are in a named pair in the arguments to a function // call or set rule.