Remove unnecessary 'static bounds

This commit is contained in:
Laurenz 2023-09-26 13:42:11 +02:00
parent c8ebcd70d6
commit 2fd0291a81
2 changed files with 7 additions and 10 deletions

View File

@ -27,7 +27,7 @@ use crate::World;
/// When `explicit` is `true`, the user requested the completion by pressing /// When `explicit` is `true`, the user requested the completion by pressing
/// control and space or something similar. /// control and space or something similar.
pub fn autocomplete( pub fn autocomplete(
world: &(dyn World + 'static), world: &dyn World,
frames: &[Frame], frames: &[Frame],
source: &Source, source: &Source,
cursor: usize, cursor: usize,
@ -944,7 +944,7 @@ fn code_completions(ctx: &mut CompletionContext, hashtag: bool) {
/// Context for autocompletion. /// Context for autocompletion.
struct CompletionContext<'a> { struct CompletionContext<'a> {
world: &'a (dyn World + 'static), world: &'a (dyn World + 'a),
frames: &'a [Frame], frames: &'a [Frame],
library: &'a Library, library: &'a Library,
global: &'a Scope, global: &'a Scope,
@ -963,7 +963,7 @@ struct CompletionContext<'a> {
impl<'a> CompletionContext<'a> { impl<'a> CompletionContext<'a> {
/// Create a new autocompletion context. /// Create a new autocompletion context.
fn new( fn new(
world: &'a (dyn World + 'static), world: &'a (dyn World + 'a),
frames: &'a [Frame], frames: &'a [Frame],
source: &'a Source, source: &'a Source,
cursor: usize, cursor: usize,

View File

@ -16,7 +16,7 @@ use crate::World;
/// Describe the item under the cursor. /// Describe the item under the cursor.
pub fn tooltip( pub fn tooltip(
world: &(dyn World + 'static), world: &dyn World,
frames: &[Frame], frames: &[Frame],
source: &Source, source: &Source,
cursor: usize, cursor: usize,
@ -43,7 +43,7 @@ pub enum Tooltip {
} }
/// Tooltip for a hovered expression. /// Tooltip for a hovered expression.
fn expr_tooltip(world: &(dyn World + 'static), leaf: &LinkedNode) -> Option<Tooltip> { fn expr_tooltip(world: &dyn World, leaf: &LinkedNode) -> Option<Tooltip> {
let mut ancestor = leaf; let mut ancestor = leaf;
while !ancestor.is::<ast::Expr>() { while !ancestor.is::<ast::Expr>() {
ancestor = ancestor.parent()?; ancestor = ancestor.parent()?;
@ -143,7 +143,7 @@ fn length_tooltip(length: Length) -> Option<Tooltip> {
/// Tooltip for a hovered reference. /// Tooltip for a hovered reference.
fn ref_tooltip( fn ref_tooltip(
world: &(dyn World + 'static), world: &dyn World,
frames: &[Frame], frames: &[Frame],
leaf: &LinkedNode, leaf: &LinkedNode,
) -> Option<Tooltip> { ) -> Option<Tooltip> {
@ -162,10 +162,7 @@ fn ref_tooltip(
} }
/// Tooltips for components of a named parameter. /// Tooltips for components of a named parameter.
fn named_param_tooltip( fn named_param_tooltip(world: &dyn World, leaf: &LinkedNode) -> Option<Tooltip> {
world: &(dyn World + 'static),
leaf: &LinkedNode,
) -> Option<Tooltip> {
let (func, named) = if_chain! { let (func, named) = if_chain! {
// Ensure that we are in a named pair in the arguments to a function // Ensure that we are in a named pair in the arguments to a function
// call or set rule. // call or set rule.