Skip to content

Commit

Permalink
elided some more lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Nov 4, 2023
1 parent f1e33ce commit c4f4b80
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions fastn-core/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ fn cached_parse(
}

#[tracing::instrument(skip_all)]
pub async fn interpret_helper<'a>(
pub async fn interpret_helper(
name: &str,
source: &str,
lib: &'a mut fastn_core::Library2022,
lib: &mut fastn_core::Library2022,
base_url: &str,
download_assets: bool,
line_number: usize,
Expand Down Expand Up @@ -112,8 +112,8 @@ pub async fn interpret_helper<'a>(
Ok(document)
}

pub async fn resolve_import<'a>(
lib: &'a mut fastn_core::Library2,
pub async fn resolve_import(
lib: &mut fastn_core::Library2,
state: &mut ftd::ftd2021::InterpreterState,
module: &str,
) -> ftd::ftd2021::p1::Result<String> {
Expand Down Expand Up @@ -159,8 +159,8 @@ pub async fn resolve_import<'a>(
}

// source, foreign_variable, foreign_function
pub async fn resolve_import_2022<'a>(
lib: &'a mut fastn_core::Library2022,
pub async fn resolve_import_2022(
lib: &mut fastn_core::Library2022,
_state: &mut ftd::interpreter::InterpreterState,
module: &str,
caller_module: &str,
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/executor/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Default for RT {
}
}

impl<'a> ExecuteDoc<'a> {
impl ExecuteDoc<'_> {
#[tracing::instrument(skip_all)]
pub fn from_interpreter(document: ftd::interpreter::Document) -> ftd::executor::Result<RT> {
let mut document = document;
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/executor/tdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct TDoc<'a> {
pub rive_data: &'a mut Vec<ftd::executor::RiveData>,
}

impl<'a> TDoc<'a> {
impl TDoc<'_> {
pub(crate) fn itdoc(&self) -> ftd::interpreter::TDoc {
ftd::interpreter::TDoc::new(self.name, self.aliases, self.bag)
}
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/ftd2021/execute_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct ExecuteDoc<'a> {
pub invocations: &'a mut ftd::Map<Vec<ftd::Map<ftd::Value>>>,
}

impl<'a> ExecuteDoc<'a> {
impl ExecuteDoc<'_> {
pub(crate) fn execute(
&mut self,
parent_container: &[usize],
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/ftd2021/interpreter/tdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub struct TDoc<'a> {
pub bag: &'a ftd::Map<ftd::ftd2021::interpreter::Thing>,
}

impl<'a> TDoc<'a> {
impl TDoc<'_> {
pub fn resolve_name(&self, name: &str) -> String {
ftd::ftd2021::interpreter::utils::resolve_name(name, self.name, self.aliases)
}
Expand Down
16 changes: 8 additions & 8 deletions ftd/src/ftd2021/p2/tdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct TDoc<'a> {
pub referenced_local_variables: &'a mut ftd::Map<String>,
}

impl<'a> TDoc<'a> {
impl TDoc<'_> {
fn get_local_variable<'b>(
&'b self,
key: &'b str,
Expand Down Expand Up @@ -1147,7 +1147,7 @@ impl<'a> TDoc<'a> {
}
}

pub fn get_root(
pub fn get_root<'a>(
&'a self,
name: &'a str,
line_number: usize,
Expand Down Expand Up @@ -1181,9 +1181,9 @@ impl<'a> TDoc<'a> {
// name = foo | alias.foo | a/b#foo

pub fn get_initial_thing(
&'a self,
&self,
line_number: usize,
name: &'a str,
name: &str,
) -> ftd::ftd2021::p1::Result<(ftd::ftd2021::p2::Thing, Option<String>)> {
if name.contains('#') {
let (name, remaining_value) = {
Expand Down Expand Up @@ -1255,9 +1255,9 @@ impl<'a> TDoc<'a> {
}

pub fn set_value(
&'a self,
&self,
line_number: usize,
name: &'a str,
name: &str,
value: ftd::Variable,
) -> ftd::ftd2021::p1::Result<ftd::Variable> {
let (initial_thing, remaining) = self.get_initial_thing(line_number, name)?;
Expand Down Expand Up @@ -1339,9 +1339,9 @@ impl<'a> TDoc<'a> {
}

pub fn get_thing(
&'a self,
&self,
line_number: usize,
name: &'a str,
name: &str,
) -> ftd::ftd2021::p1::Result<ftd::ftd2021::p2::Thing> {
let name = if let Some(name) = name.strip_prefix('$') {
name
Expand Down
4 changes: 2 additions & 2 deletions ftd/src/html/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ pub struct DataGenerator<'a> {
pub doc: &'a ftd::interpreter::TDoc<'a>,
}

impl<'a> DataGenerator<'a> {
pub(crate) fn new(doc: &'a ftd::interpreter::TDoc<'a>) -> DataGenerator<'a> {
impl DataGenerator<'_> {
pub(crate) fn new<'a>(doc: &'a ftd::interpreter::TDoc<'a>) -> DataGenerator<'a> {
DataGenerator { doc }
}

Expand Down
4 changes: 2 additions & 2 deletions ftd/src/html/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ pub struct DependencyGenerator<'a> {
pub doc: &'a ftd::interpreter::TDoc<'a>,
}

impl<'a> DependencyGenerator<'a> {
pub(crate) fn new(
impl DependencyGenerator<'_> {
pub(crate) fn new<'a>(
id: &'a str,
node: &'a ftd::node::Node,
html_data: &'a ftd::node::HTMLData,
Expand Down
8 changes: 4 additions & 4 deletions ftd/src/html/dummy_html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ pub(crate) struct DummyHtmlGenerator<'a> {
pub doc: &'a ftd::interpreter::TDoc<'a>,
}

impl<'a> DummyHtmlGenerator<'a> {
pub fn new(id: &str, doc: &'a ftd::interpreter::TDoc<'a>) -> DummyHtmlGenerator<'a> {
impl DummyHtmlGenerator<'_> {
pub fn new<'a>(id: &str, doc: &'a ftd::interpreter::TDoc<'a>) -> DummyHtmlGenerator<'a> {
DummyHtmlGenerator {
id: id.to_string(),
doc,
Expand Down Expand Up @@ -155,8 +155,8 @@ pub(crate) struct HelperHtmlGenerator<'a> {
pub doc: &'a ftd::interpreter::TDoc<'a>,
}

impl<'a> HelperHtmlGenerator<'a> {
pub fn new(id: &str, doc: &'a ftd::interpreter::TDoc<'a>) -> HelperHtmlGenerator<'a> {
impl HelperHtmlGenerator<'_> {
pub fn new<'a>(id: &str, doc: &'a ftd::interpreter::TDoc<'a>) -> HelperHtmlGenerator<'a> {
HelperHtmlGenerator {
id: id.to_string(),
doc,
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/html/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl ftd::html::Action {
}
}

impl<'a> ftd::html::main::HtmlGenerator<'a> {
impl ftd::html::main::HtmlGenerator<'_> {
pub(crate) fn group_by_js_event(
&self,
evts: &[ftd::node::Event],
Expand Down
4 changes: 2 additions & 2 deletions ftd/src/html/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ pub(crate) struct HtmlGenerator<'a> {
pub immutable_variable: Vec<String>,
}

impl<'a> HtmlGenerator<'a> {
pub fn new(id: &str, doc: &'a ftd::interpreter::TDoc<'a>) -> HtmlGenerator<'a> {
impl HtmlGenerator<'_> {
pub fn new<'a>(id: &str, doc: &'a ftd::interpreter::TDoc<'a>) -> HtmlGenerator<'a> {
HtmlGenerator {
id: id.to_string(),
doc,
Expand Down
4 changes: 2 additions & 2 deletions ftd/src/html/variable_dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pub struct VariableDependencyGenerator<'a> {
pub doc: &'a ftd::interpreter::TDoc<'a>,
}

impl<'a> VariableDependencyGenerator<'a> {
pub(crate) fn new(
impl VariableDependencyGenerator<'_> {
pub(crate) fn new<'a>(
id: &'a str,
doc: &'a ftd::interpreter::TDoc,
) -> VariableDependencyGenerator<'a> {
Expand Down
2 changes: 1 addition & 1 deletion ftd/src/interpreter/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ impl InterpreterState {
}
}

pub fn interpret<'a>(id: &'a str, source: &'a str) -> ftd::interpreter::Result<Interpreter> {
pub fn interpret(id: &str, source: &str) -> ftd::interpreter::Result<Interpreter> {
let doc = ParsedDocument::parse_with_line_number(id, source, 0)?;
interpret_with_line_number(id, doc, 0)
}
Expand Down
10 changes: 5 additions & 5 deletions ftd/src/interpreter/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ pub(crate) fn get_special_variable() -> Vec<&'static str> {
]
}

pub fn is_argument_in_component_or_loop<'a>(
name: &'a str,
doc: &'a ftd::interpreter::TDoc,
component_definition_name_with_arguments: Option<(&'a str, &'a [String])>,
loop_object_name_and_kind: &'a Option<String>,
pub fn is_argument_in_component_or_loop(
name: &str,
doc: &ftd::interpreter::TDoc,
component_definition_name_with_arguments: Option<(&str, &[String])>,
loop_object_name_and_kind: &Option<String>,
) -> bool {
use itertools::Itertools;

Expand Down

0 comments on commit c4f4b80

Please sign in to comment.