refactor: loosen lifetime bounds
This commit is contained in:
parent
0f937fe9a8
commit
e23327c08f
1 changed files with 2 additions and 8 deletions
|
|
@ -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)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue