refactor: loosen lifetime bounds

This commit is contained in:
electria 2026-10-19 00:19:35 -07:00
commit e23327c08f
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -32,16 +32,10 @@ pub fn pretty_eval(input: &str, max_digits: usize) -> Result<String, Error> {
} }
trait StrExt { trait StrExt {
fn rsplit_once_last<'a>( fn rsplit_once_last<'a, 'b>(&'a self, delimiters: &[&'b str]) -> (&'a str, &'b str, &'a str);
&'a self,
delimiters: &[&'static str],
) -> (&'a str, &'static str, &'a str);
} }
impl StrExt for str { impl StrExt for str {
fn rsplit_once_last<'a>( fn rsplit_once_last<'a, 'b>(&'a self, delimiters: &[&'b str]) -> (&'a str, &'b str, &'a str) {
&'a self,
delimiters: &[&'static str],
) -> (&'a str, &'static str, &'a str) {
delimiters delimiters
.iter() .iter()
.filter_map(|delimiter| self.rfind(delimiter).map(|i| (delimiter, i))) .filter_map(|delimiter| self.rfind(delimiter).map(|i| (delimiter, i)))