diff options
Diffstat (limited to 'src/launcher/strsub.rs')
| -rw-r--r-- | src/launcher/strsub.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/launcher/strsub.rs b/src/launcher/strsub.rs index 0d2357d..5764405 100644 --- a/src/launcher/strsub.rs +++ b/src/launcher/strsub.rs @@ -69,7 +69,7 @@ pub fn replace_string<'inp, 'rep>(input: &'inp str, sub: &impl SubFunc<'rep>) -> let spec_start = idx + VAR_BEGIN.len(); // the start of the "spec" (area inside {}) // first, check if this is escaped - if let Some((prev_idx, ESCAPE)) = input[..idx].char_indices().rev().next() { + if let Some((prev_idx, ESCAPE)) = input[..idx].char_indices().next_back() { let s = ret.get_or_insert_default(); s.push_str(&input[cursor..prev_idx]); @@ -94,7 +94,7 @@ pub fn replace_string<'inp, 'rep>(input: &'inp str, sub: &impl SubFunc<'rep>) -> }; let after = spec_end + VAR_END.len(); - if let Some(subst) = sub.substitute(name).map_or_else(|| def.map(|d| Cow::Borrowed(d)), |v| Some(v)) { + if let Some(subst) = sub.substitute(name).map_or_else(|| def.map(Cow::Borrowed), Some) { let s = ret.get_or_insert_default(); s.push_str(&input[cursor..idx]); s.push_str(subst.as_ref()); |
