File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -1742,19 +1742,19 @@ pub trait Itertools : Iterator {
1742
1742
/// assert_eq!(numbers.iter().find_or_last(|&&x| x > 2), Some(&3));
1743
1743
/// assert_eq!(std::iter::empty::<i32>().find_or_last(|&x| x > 5), None);
1744
1744
/// ```
1745
- fn find_or_last < P > ( mut self , predicate : P ) -> Option < Self :: Item >
1746
- where Self : Sized ,
1747
- P : FnMut ( & Self :: Item ) -> bool ,
1748
- {
1749
- #[ inline]
1745
+ fn find_or_last < P > ( mut self , predicate : P ) -> Option < Self :: Item >
1746
+ where Self : Sized ,
1747
+ P : FnMut ( & Self :: Item ) -> bool ,
1748
+ {
1749
+ #[ inline]
1750
1750
fn check < T > ( mut predicate : impl FnMut ( & T ) -> bool ) -> impl FnMut ( Option < T > , T ) -> Result < Option < T > , T > {
1751
1751
move |_, x| {
1752
1752
if predicate ( & x) { Result :: Err ( x) } else { Result :: Ok ( Some ( x) ) }
1753
1753
}
1754
1754
}
1755
1755
1756
1756
self . try_fold ( None , check ( predicate) ) . unwrap_or_else ( Some )
1757
- }
1757
+ }
1758
1758
/// Returns `true` if the given item is present in this iterator.
1759
1759
///
1760
1760
/// This method is short-circuiting. If the given item is present in this
You can’t perform that action at this time.
0 commit comments