- Removed notes
- Removed superfluous uses of `where`
This commit is contained in:
2023-05-23 18:39:45 +01:00
parent 8bb82b8ead
commit e99ade92ba
63 changed files with 76 additions and 1973 deletions

View File

@@ -2,9 +2,12 @@ use std::iter;
/// Iterate over a sequence with the first element the function returns
/// Some() for updated, but only if there is such an element.
pub fn replace_first<'a, T, F>(slice: &'a [T], mut f: F)
-> Option<impl Iterator<Item = T> + 'a>
where T: Clone, F: FnMut(&T) -> Option<T> {
pub fn replace_first<
T: Clone,
F: FnMut(&T) -> Option<T>
>(
slice: &[T], mut f: F
) -> Option<impl Iterator<Item = T> + '_> {
for i in 0..slice.len() {
if let Some(new) = f(&slice[i]) {
let subbed_iter = slice[0..i].iter().cloned()