From 192a4a2891552101250d59aa6e0fe83fa4ff05d8 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 16 Oct 2023 16:30:39 -0400 Subject: [PATCH] Remove unnecessary lifetimes. --- src/types/util.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/types/util.rs b/src/types/util.rs index 99cf5ed8..833ee422 100644 --- a/src/types/util.rs +++ b/src/types/util.rs @@ -3,7 +3,7 @@ use std::borrow::Cow; /// Removes all whitespace from a string if any line breaks are present. /// /// Example: "foo bar" => "foo bar" but "foo \n bar" => "foobar". -pub(crate) fn remove_whitespace_if_line_break<'s>(input: &'s str) -> Cow<'s, str> { +pub(crate) fn remove_whitespace_if_line_break(input: &str) -> Cow<'_, str> { let mut state = RemoveWhitespaceIfLineBreakState::Normal; for (offset, c) in input.char_indices() { match (&mut state, c) { @@ -49,7 +49,7 @@ enum RemoveWhitespaceIfLineBreakState { /// Removes all line breaks from a string /// /// Example: "foo bar" => "foo bar" but "foo \n bar" => "foo bar". -pub(crate) fn remove_line_break<'s>(input: &'s str) -> Cow<'s, str> { +pub(crate) fn remove_line_break(input: &str) -> Cow<'_, str> { let mut state = RemoveLineBreakState::Normal; for (offset, c) in input.char_indices() { match (&mut state, c) { @@ -79,7 +79,7 @@ enum RemoveLineBreakState { /// Removes all whitespace from a string if any line breaks are present. /// /// Example: "foo bar" => "foo bar" but "foo \n bar" => "foobar". -pub(crate) fn coalesce_whitespace_if_line_break<'s>(input: &'s str) -> Cow<'s, str> { +pub(crate) fn coalesce_whitespace_if_line_break(input: &str) -> Cow<'_, str> { let mut state = CoalesceWhitespaceIfLineBreakState::Normal; for (offset, c) in input.char_indices() { match (&mut state, c) { @@ -202,7 +202,7 @@ enum CoalesceWhitespaceIfLineBreakState { /// /// Example: "foo bar" => "foobar" and "foo \n bar" => "foobar". #[allow(dead_code)] -pub(crate) fn coalesce_whitespace<'s>(input: &'s str) -> Cow<'s, str> { +pub(crate) fn coalesce_whitespace(input: &str) -> Cow<'_, str> { let mut state = CoalesceWhitespace::Normal; for (offset, c) in input.char_indices() { match (&mut state, c) { @@ -248,18 +248,18 @@ enum CoalesceWhitespace { /// Removes all whitespace from a string and handle escaping characters. /// /// Example: "foo bar" => "foobar" and "foo \n bar" => "foobar" but if the escape character is backslash and comma is an escapable character than "foo\,bar" becomes "foo,bar". -pub(crate) fn coalesce_whitespace_escaped<'c, C: Fn(char) -> bool>( +pub(crate) fn coalesce_whitespace_escaped bool>( escape_character: char, escapable_characters: C, ) -> impl for<'s> Fn(&'s str) -> Cow<'s, str> { move |input| impl_coalesce_whitespace_escaped(input, escape_character, &escapable_characters) } -fn impl_coalesce_whitespace_escaped<'s, C: Fn(char) -> bool>( - input: &'s str, +fn impl_coalesce_whitespace_escaped bool>( + input: &str, escape_character: char, escapable_characters: C, -) -> Cow<'s, str> { +) -> Cow<'_, str> { let mut state = CoalesceWhitespaceEscaped::Normal { in_whitespace: false, }; @@ -451,7 +451,7 @@ enum CoalesceWhitespaceEscaped { }, } -pub(crate) fn to_lowercase<'s>(input: &'s str) -> Cow<'s, str> { +pub(crate) fn to_lowercase(input: &str) -> Cow<'_, str> { if input.chars().any(|c| !c.is_lowercase()) { Cow::Owned(input.to_lowercase()) } else {