Update RefContext to three lifetimes.

This commit is contained in:
Tom Alexander
2023-09-02 22:45:46 -04:00
parent ba57eb16fd
commit 74a6101de7
41 changed files with 200 additions and 200 deletions

View File

@@ -26,7 +26,7 @@ pub const WORD_CONSTITUENT_CHARACTERS: &str =
/// Check if we are below a section of the given section type regardless of depth
#[allow(dead_code)]
pub fn in_section<'r, 's, 'x>(context: RefContext<'r, 's>, section_name: &'x str) -> bool {
pub fn in_section<'r, 's, 'x>(context: RefContext<'_, 'r, 's>, section_name: &'x str) -> bool {
for thing in context.iter() {
match thing.get_data() {
ContextElement::Context(name) if *name == section_name => return true,
@@ -38,7 +38,7 @@ pub fn in_section<'r, 's, 'x>(context: RefContext<'r, 's>, section_name: &'x str
/// Checks if we are currently an immediate child of the given section type
pub fn immediate_in_section<'r, 's, 'x>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
section_name: &'x str,
) -> bool {
for thing in context.iter() {
@@ -73,7 +73,7 @@ pub fn element_trailing_whitespace<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn maybe_consume_object_trailing_whitespace_if_not_exiting<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
if exit_matcher_parser(context, input).is_err() {
@@ -85,7 +85,7 @@ pub fn maybe_consume_object_trailing_whitespace_if_not_exiting<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn maybe_consume_trailing_whitespace_if_not_exiting<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
if context.should_consume_trailing_whitespace() && exit_matcher_parser(context, input).is_err()
@@ -98,7 +98,7 @@ pub fn maybe_consume_trailing_whitespace_if_not_exiting<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn maybe_consume_trailing_whitespace<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
if context.should_consume_trailing_whitespace() {
@@ -147,7 +147,7 @@ pub fn non_whitespace_character(input: OrgSource<'_>) -> Res<OrgSource<'_>, char
/// Check that we are at the start of a line
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn exit_matcher_parser<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
peek(|i| context.check_exit_matcher(i))(input)
@@ -155,7 +155,7 @@ pub fn exit_matcher_parser<'r, 's>(
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn text_until_exit<'r, 's>(
context: RefContext<'r, 's>,
context: RefContext<'_, 'r, 's>,
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(verify(